GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fixup for __module__ attribute setting · ssam18/python@2e3ae9d

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • include/boost/python/detail
    • module_base.hpp
  • src
    • module.cpp
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎include/boost/python/detail/module_base.hpp‎

Copy file name to clipboardExpand all lines: include/boost/python/detail/module_base.hpp
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class BOOST_PYTHON_DECL module_base
2727
inline ref object() const;
2828

2929
protected:
30-
void generic_add_class(ref class_obj);
30+
void add_class(ref const& class_obj);
3131

3232
private:
3333
ref m_module;
Collapse file

‎src/module.cpp‎

Copy file name to clipboardExpand all lines: src/module.cpp
+12-7Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,20 @@ void module_base::add_type(ref x)
4545
add((PyTypeObject*)x.release());
4646
}
4747

48-
void module_base::generic_add_class(ref class_obj)
48+
void module_base::add_class(ref const& class_obj)
4949
{
50-
Py_INCREF(class_obj.get());
5150
this->add_type(class_obj);
52-
ref module_name(PyObject_GetAttrString(m_module.get(),
53-
const_cast<char*>("__name__")));
54-
int status = PyObject_SetAttrString(class_obj.get(),
55-
const_cast<char*>("__module__"), module_name.get());
56-
if (status == -1) throw_error_already_set();
51+
52+
ref module_name(
53+
PyObject_GetAttrString(
54+
m_module.get(), const_cast<char*>("__name__"))
55+
);
56+
57+
int status = PyObject_SetAttrString(
58+
class_obj.get(), const_cast<char*>("__module__"), module_name.get());
59+
60+
if (status == -1)
61+
throw_error_already_set();
5762
}
5863

5964
PyMethodDef module_base::initial_methods[] = { { 0, 0, 0, 0 } };

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.