Many, many (many!) changes needed to build and run the Phoenix extension modules with Python 3. Where possible changes were made such that the code works with both Python 2.7 and 3.2 without conditionals. In general the following types of changes were made:

* Changed imports to use either absolute or explicit relative imports.  Implicit relative imports are no longer allowed.

 * Changes to accomodate standard library classes or modues moving to other locations, or being removed entirely.

 * Changes related to print becoming a function, execfile being removed, u'' no longer allowed, and other syntax related issues.

 * Working around C APIs that have changed or simply vanished. (PyInt, PyString, PyBytes, etc.)

 * Dealing with text file objects using strings vs binary file objects using bytes, auto-encoding, and etc.

 * Replacing the use of PyCObject with PyCapsule and dealing with an apparent bug where PyCapsule objects can't be imported from submodules within a package.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@71554 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2012-05-24 23:28:02 +00:00
parent 7813eacd4b
commit b41df0b779
62 changed files with 521 additions and 365 deletions

View File

@@ -42,44 +42,11 @@ void wxPyCallback::EventThunker(wxEvent& event) {
wxPyBlock_t blocked = wxPyBeginBlockThreads();
wxString className = event.GetClassInfo()->GetClassName();
// // If the event is one of these types then pass the original
// // event object instead of the one passed to us.
// if ( className == wxT("wxPyEvent") ) {
// arg = ((wxPyEvent*)&event)->GetSelf();
// checkSkip = ((wxPyEvent*)&event)->GetCloned();
// }
// else if ( className == wxT("wxPyCommandEvent") ) {
// arg = ((wxPyCommandEvent*)&event)->GetSelf();
// checkSkip = ((wxPyCommandEvent*)&event)->GetCloned();
// }
// else {
arg = wxPyConstructObject((void*)&event, className);
// }
arg = wxPyConstructObject((void*)&event, className);
if (!arg) {
PyErr_Print();
} else {
// // "intern" the pre/post method names to speed up the HasAttr
// static PyObject* s_preName = NULL;
// static PyObject* s_postName = NULL;
// if (s_preName == NULL) {
// s_preName = PyString_FromString(wxPy_PRECALLINIT);
// s_postName = PyString_FromString(wxPy_POSTCALLCLEANUP);
// }
// // Check if the event object needs some preinitialization
// if (PyObject_HasAttr(arg, s_preName)) {
// result = PyObject_CallMethodObjArgs(arg, s_preName, arg, NULL);
// if ( result ) {
// Py_DECREF(result); // result is ignored, but we still need to decref it
// PyErr_Clear(); // Just in case...
// } else {
// PyErr_Print();
// }
// }
// Call the event handler, passing the event object
tuple = PyTuple_New(1);
PyTuple_SET_ITEM(tuple, 0, arg); // steals ref to arg
@@ -90,30 +57,6 @@ void wxPyCallback::EventThunker(wxEvent& event) {
} else {
PyErr_Print();
}
// // Check if the event object needs some post cleanup
// if (PyObject_HasAttr(arg, s_postName)) {
// result = PyObject_CallMethodObjArgs(arg, s_postName, arg, NULL);
// if ( result ) {
// Py_DECREF(result); // result is ignored, but we still need to decref it
// PyErr_Clear(); // Just in case...
// } else {
// PyErr_Print();
// }
// }
// if ( checkSkip ) {
// // if the event object was one of our special types and
// // it had been cloned, then we need to extract the Skipped
// // value from the original and set it in the clone.
// result = PyObject_CallMethod(arg, "GetSkipped", "");
// if ( result ) {
// event.Skip(PyInt_AsLong(result));
// Py_DECREF(result);
// } else {
// PyErr_Print();
// }
// }
Py_DECREF(tuple);
}
wxPyEndBlockThreads(blocked);