mirror of
https://github.com/pybind/pybind11.git
synced 2024-12-01 01:17:10 +00:00
d079f41c26
Fixes #509. The move policy was already set for rvalues in PR #473, but this only applied to directly cast user-defined types. The problem is that STL containers cast values indirectly and the rvalue information is lost. Therefore the move policy was not set correctly. This commit fixes it. This also makes an additional adjustment to remove the `copy` policy exception: rvalues now always use the `move` policy. This is also safe for copy-only rvalues because the `move` policy has an internal fallback to copying.
39 lines
1.1 KiB
Python
39 lines
1.1 KiB
Python
from __future__ import print_function, division
|
|
import os
|
|
import sys
|
|
|
|
# Internal build script for generating debugging test .so size.
|
|
# Usage:
|
|
# python libsize.py file.so save.txt -- displays the size of file.so and, if save.txt exists, compares it to the
|
|
# size in it, then overwrites save.txt with the new size for future runs.
|
|
|
|
if len(sys.argv) != 3:
|
|
sys.exit("Invalid arguments: usage: python libsize.py file.so save.txt")
|
|
|
|
lib = sys.argv[1]
|
|
save = sys.argv[2]
|
|
|
|
if not os.path.exists(lib):
|
|
sys.exit("Error: requested file ({}) does not exist".format(lib))
|
|
|
|
libsize = os.path.getsize(lib)
|
|
|
|
print("------", os.path.basename(lib), "file size:", libsize, end='')
|
|
|
|
if os.path.exists(save):
|
|
with open(save) as sf:
|
|
oldsize = int(sf.readline())
|
|
|
|
if oldsize > 0:
|
|
change = libsize - oldsize
|
|
if change == 0:
|
|
print(" (no change)")
|
|
else:
|
|
print(" (change of {:+} bytes = {:+.2%})".format(change, change / oldsize))
|
|
else:
|
|
print()
|
|
|
|
with open(save, 'w') as sf:
|
|
sf.write(str(libsize))
|
|
|