Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
pybind11
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open
pybind11
Commits
3d4bf091
Commit
3d4bf091
authored
Jan 20, 2021
by
Ralf W. Grosse-Kunstleve
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Decoupling generic_type from type_caster_generic.
parent
e345db05
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
4 deletions
+5
-4
include/pybind11/classh.h
+1
-1
include/pybind11/pybind11.h
+4
-3
No files found.
include/pybind11/classh.h
View file @
3d4bf091
...
...
@@ -60,7 +60,7 @@ public:
/* Process optional arguments, if any */
process_attributes
<
Extra
...
>::
init
(
extra
...,
&
record
);
generic_type
::
initialize
(
record
);
generic_type
::
initialize
(
record
,
&
modified_type_caster_generic_load_impl
::
local_load
);
if
(
has_alias
)
{
auto
&
instances
=
record
.
module_local
?
registered_local_types_cpp
()
:
get_internals
().
registered_types_cpp
;
...
...
include/pybind11/pybind11.h
View file @
3d4bf091
...
...
@@ -1082,7 +1082,8 @@ class generic_type : public object {
public
:
PYBIND11_OBJECT_DEFAULT
(
generic_type
,
object
,
PyType_Check
)
protected
:
void
initialize
(
const
type_record
&
rec
)
{
void
initialize
(
const
type_record
&
rec
,
void
*
(
*
type_caster_module_local_load
)(
PyObject
*
,
const
type_info
*
))
{
if
(
rec
.
scope
&&
hasattr
(
rec
.
scope
,
"__dict__"
)
&&
rec
.
scope
.
attr
(
"__dict__"
).
contains
(
rec
.
name
))
pybind11_fail
(
"generic_type: cannot initialize type
\"
"
+
std
::
string
(
rec
.
name
)
+
"
\"
: an object with that name is already defined"
);
...
...
@@ -1128,7 +1129,7 @@ protected:
if
(
rec
.
module_local
)
{
// Stash the local typeinfo and loader so that external modules can access it.
tinfo
->
module_local_load
=
&
type_caster_generic
::
local_load
;
// TODO classh_type_casters local_load
tinfo
->
module_local_load
=
type_caster_module_local_load
;
setattr
(
m_ptr
,
PYBIND11_MODULE_LOCAL_ID
,
capsule
(
tinfo
));
}
}
...
...
@@ -1295,7 +1296,7 @@ public:
/* Process optional arguments, if any */
process_attributes
<
Extra
...
>::
init
(
extra
...,
&
record
);
generic_type
::
initialize
(
record
);
generic_type
::
initialize
(
record
,
&
type_caster_generic
::
local_load
);
if
(
has_alias
)
{
auto
&
instances
=
record
.
module_local
?
registered_local_types_cpp
()
:
get_internals
().
registered_types_cpp
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment