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 — Fix compilation with python 3.0-3.3 · mborgerding/python@36f8f69

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • src
    • exec.cpp
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/exec.cpp‎

Copy file name to clipboardExpand all lines: src/exec.cpp
+5-4Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,12 @@ object BOOST_PYTHON_DECL exec_file(str filename, object global, object local)
8484
if (local.is_none()) local = global;
8585
// should be 'char const *' but older python versions don't use 'const' yet.
8686
char *f = python::extract<char *>(filename);
87-
#if PY_VERSION_HEX >= 0x03000000
88-
// TODO(bhy) temporary workaround for Python 3.
89-
// should figure out a way to avoid binary incompatibilities as the Python 2
90-
// version did.
87+
#if PY_VERSION_HEX >= 0x03040000
9188
FILE *fs = fopen(f, "r");
89+
#elif PY_VERSION_HEX >= 0x03000000
90+
PyObject *fo = Py_BuildValue("s", f);
91+
FILE *fs = _Py_fopen(fo, "r");
92+
Py_DECREF(fo);
9293
#else
9394
// Let python open the file to avoid potential binary incompatibilities.
9495
PyObject *pyfile = PyFile_FromString(f, const_cast<char*>("r"));

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.