Skip to content

Commit

Permalink
- replace deprecated python flags with corresponding PyConfig parameters
Browse files Browse the repository at this point in the history
- make method const
  • Loading branch information
chcg committed Dec 26, 2023
1 parent 05dd3a2 commit f4b6f02
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
1 change: 0 additions & 1 deletion .github/workflows/CI_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,4 @@ jobs:
Rename-Item -Path ".\buildPaths.bat.orig" -NewName "buildPaths.bat"
$env:WIX_PATH="C:\Program Files (x86)\WiX Toolset v3.11\bin"
$env:PATH = $env:PATH + ';' + $env:WIX_PATH
$env:PATH
.\buildAll.bat ${{ matrix.build_platform }}
25 changes: 13 additions & 12 deletions PythonScript/src/PythonHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,17 @@ void PythonHandler::initPython()
PyConfig config;
PyConfig_InitPythonConfig(&config);

// Don't import site - if Python 2.7 doesn't find it as part of Py_Initialize,
// it does an exit(1) - AGH!
// unclear if this is still the case with python 3.12
config.site_import = 0;
config.use_environment = 0;
config.user_site_directory = 0;

#ifdef _DEBUG
config.verbose = 1;
#endif

// Read all configuration at once
// implicit pre config python
status = PyConfig_Read(&config);
Expand All @@ -102,16 +113,6 @@ void PythonHandler::initPython()
PyConfig_Clear(&config);
}

// Don't import site - if Python 2.7 doesn't find it as part of Py_Initialize,
// it does an exit(1) - AGH!
Py_NoSiteFlag = 1;
Py_IgnoreEnvironmentFlag = 1;
Py_NoUserSiteDirectory = 1;

#ifdef _DEBUG
Py_VerboseFlag = 1;
#endif

bool configSetFailed = false;

//appended or prepended below in this order
Expand Down Expand Up @@ -257,8 +258,8 @@ void PythonHandler::initSysArgv()
argvList.append(boost::python::handle<>(unicodeArg));
}

boost::python::object sysModule(boost::python::handle<>(boost::python::borrowed(PyImport_AddModule("sys"))));
sysModule.attr("argv") = argvList;
//boost::python::object sysModule(boost::python::handle<>(boost::python::borrowed(PyImport_AddModule("sys"))));
//sysModule.attr("argv") = argvList;


}
Expand Down
12 changes: 6 additions & 6 deletions PythonScript/src/ScintillaCallback.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@
namespace NppPythonScript
{

class ScintillaCallback
class ScintillaCallback
{
public:
ScintillaCallback(boost::python::object callback, bool isAsync)
ScintillaCallback(boost::python::object callback, bool isAsync)
: m_callback(callback),
m_isAsync(isAsync)
m_isAsync(isAsync)
{}


boost::python::object getCallback() { return m_callback; }
bool isAsync() { return m_isAsync; }
bool isAsync() const { return m_isAsync; }

private:
boost::python::object m_callback;
bool m_isAsync;
bool m_isAsync;
};
}

#endif // SCINTILLACALLBACK_20140303_H
#endif // SCINTILLACALLBACK_20140303_H

0 comments on commit f4b6f02

Please sign in to comment.