Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 2.3k
Add default and converting constructors for all concrete Python types#464
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
05127a3294832ec473392ee946b8File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -111,7 +111,6 @@ | ||
| #define PYBIND11_BYTES_FROM_STRING_AND_SIZE PyBytes_FromStringAndSize | ||
| #define PYBIND11_BYTES_AS_STRING_AND_SIZE PyBytes_AsStringAndSize | ||
| #define PYBIND11_BYTES_AS_STRING PyBytes_AsString | ||
| #define PYBIND11_BYTES_CHECK PyBytes_Check | ||
| #define PYBIND11_LONG_CHECK(o) PyLong_Check(o) | ||
Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm surprised these duplicate definitions didn't cause warnings before. | ||
| #define PYBIND11_LONG_AS_LONGLONG(o) PyLong_AsLongLong(o) | ||
| #define PYBIND11_LONG_AS_UNSIGNED_LONGLONG(o) PyLong_AsUnsignedLongLong(o) | ||
| @@ -130,7 +129,6 @@ | ||
| #define PYBIND11_BYTES_FROM_STRING_AND_SIZE PyString_FromStringAndSize | ||
| #define PYBIND11_BYTES_AS_STRING_AND_SIZE PyString_AsStringAndSize | ||
| #define PYBIND11_BYTES_AS_STRING PyString_AsString | ||
| #define PYBIND11_BYTES_CHECK PyString_Check | ||
| #define PYBIND11_LONG_CHECK(o) (PyInt_Check(o) || PyLong_Check(o)) | ||
| #define PYBIND11_LONG_AS_LONGLONG(o) (PyInt_Check(o) ? (long long) PyLong_AsLong(o) : PyLong_AsLongLong(o)) | ||
| #define PYBIND11_LONG_AS_UNSIGNED_LONGLONG(o) (PyInt_Check(o) ? (unsigned long long) PyLong_AsUnsignedLong(o) : PyLong_AsUnsignedLongLong(o)) | ||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an optimization, I assume?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The way the conversion was done in the original
PYBIND11_OBJECT_CVTmacro, the move constructor was more efficient, so thestd::movehere resulted in smaller binary size. With the reworkedCVTmacro, the lvalue ref constructor is equally good, so the move isn't strictly needed any more, but it doesn't hurt either (args_list's lifetime ends here anyway).