[issue1506] func alloca inside ctypes lib needs #include on solaris
Greg Couch added the comment: A better solution would be to use the HAVE_ALLOCA and HAVE_ALLOCA_H defines that fficonfig.h provides to decide whether or not to include alloca.h. And in callproc.c whether or not to provide a workaround using malloc (I'm assuming non-gcc sparc compilers also support alloca for sparc/ffi.c, but I don't know for sure). -- nosy: +gregcouch __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1506> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1506] func alloca inside ctypes lib needs #include on solaris
Greg Couch added the comment: Turns out callproc.c forgot to include after which conditionally includes alloca.h. So it's a one-line fix. __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1506> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1516] make _ctypes work with non-gcc compilers
New submission from Greg Couch: To get _ctypes to sucessfully compile with native UNIX compilers (i.e., not gcc), several modifications need to be made: (1) use the equivalent of the Py_GCC_ATTRIBUTE macro for __attribute__ (in ffi.h), (2) include in callproc.c to conditionally include , and (3) modify distutils to know something about assembly language files. The attached patch is a starting point for the proper patch. It fixes bugs (1) and (2), but I was unable to figure out the last tweek to get distutils to work with gcc and native compilers. The problem with _ctypes comes from the use of gcc's libffi. And libffi uses assembly language source files for the various supported platforms and distutils blindly compiles the .S files. Native UNIX compilers want a .s suffix and if the files are renamed, distutils skips the file. I tried modifying distutils to compile .s files and give the '-x assembler-with-cpp' flag to gcc so gcc would still work, but the right tweek evaded me. So I'm hoping someone can take this and turn it into something better or make helpful suggestions (other than switching to gcc!). -- files: _ctypes.diffs messages: 57924 nosy: gregcouch severity: normal status: open title: make _ctypes work with non-gcc compilers versions: Python 2.6 Added file: http://bugs.python.org/file8819/_ctypes.diffs __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1516> __ _ctypes.diffs Description: Binary data ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1506] func alloca inside ctypes lib needs #include on solaris
Greg Couch added the comment: That's a disappointment. has the right logic in it already. Perhaps it should be copied to callproc.c. I'm less concerned about alloca not being there at all because it seems to be a pervasive extension in non-gcc compilers, but using malloc is fine too. Please go ahead and fix this as you see fit. I've started issue 1516 about using non-gcc compilers to compile _ctypes/libffi. __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1506> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1516] make _ctypes work with non-gcc compilers
Greg Couch added the comment: The modications work on Tru64 and IRIX. cc has understood .s suffixes for a long time. You use cc instead of as because it knows how to run the C preprocessor (often /lib/cpp, but not on all systems). Looking at the Solaris cc manual page (via google), I see that its cc has the same .S and .s distinction that gcc has, so my patch will not work with Solaris either. IRIX has a separate issue in that it has libffi support for n32 binaries, but doesn't have the ffi_closure support, so while libffi compiles, _ctypes still fails to compile (same would be true if gcc were used). __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1516> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1759845] subprocess.call fails with unicode strings in command line
Greg Couch <[EMAIL PROTECTED]> added the comment: We're having the same problem. My quick fix was to patch subprocess.py so the command line and executable are converted to the filesystem encoding (mbcs). -- nosy: +gregcouch Added file: http://bugs.python.org/file11674/Python-2.5.2-subprocess.patch ___ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1759845> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2693] IDLE doesn't work with Tk 8.5
New submission from Greg Couch <[EMAIL PROTECTED]>: IDLE and Tk 8.5 don't well work together for both Python 2.5 and 2.6a (SVN version). The reasons are related but different. In Python 2.5, you can't select any text in the IDLE window and whenever a calltip is to appear, you get a backtrace ending with "invalid literal for int() with base 10: '(72,'". That comes from an interaction between WidgetRedirector's dispatch function and _tkinter. The Text widget's bbox method returns a tuple of ints, the dispatch function isn't monitoring bbox, so it returns the tuple as is to _tkinter, where PythonCmd converts the tuple to a Python string, not a Tcl list, so when Tkinter sees the string, it can't convert to a tuple. The Python "2.6a2" SVN version of _tkinter fixes that bug but exposes others (Ikinter.py, tupleobject.c), so I've attached a simple patch for Python 2.5. The SVN version of idle appears to work, so this patch should only be on the 2.5 branch. -- components: IDLE, Tkinter files: Python-2.5.2-idlelib.patch keywords: patch messages: 65828 nosy: gregc severity: normal status: open title: IDLE doesn't work with Tk 8.5 versions: Python 2.5 Added file: http://bugs.python.org/file10112/Python-2.5.2-idlelib.patch __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2693> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2693] IDLE doesn't work with Tk 8.5
Greg Couch <[EMAIL PROTECTED]> added the comment: I wish I could be as cavalier about Tk 8.5. The last version of Tk 8.4 just came out and it really shows its age, especially on Mac OS X, and those are ~25% of our application's downloads. Since Python 2.6a2 is "not suitable for production use", that leaves us with patching 2.5. Backporting, the _tkinter and Tkinter changes, was not hard, but then we get "SystemError: Objects/tupleobject.c:89: bad argument to internal function" errors with both the 2.5 and the 2.6a2 idlelibs. Looking at the SVN log, it is not clear which patch to tupleobject.c fixed that problem (does anyone know?). So fixing WidgetRedirector.py to not screw up the string representation of tuples is the easiest solution to get idle to work with Tk 8.5. and Python 2.5 (you still would want the Tkinter.py changes for other reasons). A slightly more robust solution would be to use Tcl quoting: r = '{%s}' % '} {'.join(map(str, r)) But that has not been important in practice. __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2693> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2693] IDLE doesn't work with Tk 8.5
Greg Couch <[EMAIL PROTECTED]> added the comment: Starting over: The goal of this patch is to get Tk 8.5 to work with Python 2.5's Idle. It currently fails with a ValueError, "invalid literal for int() with base 10: '(72,'" (the 72 changes depending on what was typed in). The root cause of bug is due to an interaction between Tk 8.5 returning more results as Tcl lists, instances of Idle's WidgetRedirector class that wrap widget Tcl commands with the WidgetRedirector's dispatch method, and _tkinter's internal PythonCmd function that stringifies anything its gets from Python. What happens is that when a Python method is called on a redirected widget, the corresponding Tcl method is called using the WidgetRedirector's imposter widget command, which calls the WidgetRedirector's dispatch method from Tcl, which then invokes the original widget Tcl command, and if that command returns a Tcl list, _tkinter converts it to a Python tuple, the dispatch method returns the tuple into _tkinter, _tkinter stringifies it so it looks like a Python tuple representation instead of a Tcl list representation, returns it to Tkinter which tries to parse it like a Tcl list representation, and causes the ValueError. The correct fix is already in Python 2.6a2, which is changing Text class' index method in Tkinter.py to return a string, and changing _tkinter's PythonCmd to convert Python objects to equivalent Tcl objects. Unfortunately backporting those simple changes to Python 2.5 cause a "SystemError: Objects/tupleobject.c:89: bad argument to internal function". While that is worth further investigation, Python 2.6a2 doesn't have that problem and a simple alternative fix is available for Python 2.5, so that is for someone else to do. The alternative fix that works in Python 2.5 is to make sure that the Tcl list string representation is used for Python tuples that are returned to _tkinter's PythonCmd. Those changes are confined to the WidgetRedirector's dispatch method. Line 126 of WidgetRedirector.py: return self.tk.call((self.orig, operation) + args) is replaced with: result = self.tk.call((self.orig, operation) + args) if isinstance(result, tuple): # convert to string ourselves so we get a Tcl list # that can be converted back into a tuple by Tkinter result = '{%s}' % '} {'.join(map(str, result)) return result For Tk 8.4, the if clause is never invoked because Idle does not use any of the Tk 8.4 methods that return Tcl lists (luckily). In Tk 8.5, the additional quoting is only needed for the Tk text widget's tag names and tag ranges commands when spaces are used for tag names (explicitly not recommended), all other uses are lists of numbers. Since none of Idle's Text tags have spaces in them, that line can safely be replaced with: result = ' '.join(map(str, result)) __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2693> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue29095] Compiling Python 3.6 from source on MacOS X Sierra
Greg Couch added the comment: The problem with compiling OpenSSL from source is that it doesn't know how to access the root certificates needed for verification on Mac OS X. See issue17128 for more details. -- nosy: +gregcouch ___ Python tracker <https://bugs.python.org/issue29095> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1516] make _ctypes work with non-gcc compilers
Greg Couch added the comment: On Thu, 18 Oct 2012, Trent Nelson wrote: > Trent Nelson added the comment: > > Hi Greg, > >I realize it's been a good five years since you first raised this >issue, but I was wondering if you ever ended up making any progress >with it? > >In trying to get Python working on Snakebite UNIX boxes with vendor >CCs, I'm running into all sorts of issues. > > -- > > ___ > Python tracker > <http://bugs.python.org/issue1516> > ___ Hi Trent, Sorry to say I don't have any more insight on how to get libffi working on more platforms. Lucking ctypes isn't used in the Python core, so it's not required to get Python working. I'm using supported compilers on all platforms now. Good luck, Greg -- ___ Python tracker <http://bugs.python.org/issue1516> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16851] Hint about correct ismethod and isfunction usage
Greg Couch added the comment: In my opinion, the Python 2.7 results are wrong. In Python 2.7, inspect.ismethod returns True for both bound and unbound methods -- ie., is broken according to the documentation. As a workaround, I'm using: def is_bound_method(obj): return hasattr(obj, '__self__') and obj.__self__ is not None is_bound_method also works for methods of classes implemented in C, e.g., int: >>> a = 1 >>> is_bound_method(a.__add__) True >>> is_bound_method(int.__add__) False But is not very useful in that case because inspect.getargspec does not work for functions implemented in C. is_bound_method works unchanged in Python 3, but as noted above, in Python 3, inspect.ismethod properly distinguishes between bound and unbound methods, so it is not necessary. -- nosy: +gregcouch ___ Python tracker <http://bugs.python.org/issue16851> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1229239] optionally allow mutable builtin types
Greg Couch added the comment: FYI, I was able to work around this and use an unmodified Python by subtyping type and overriding the setattr method as shown below. It's a lot messier than patching Python. static int Mutable_SetAttr(PyObject *obj, PyObject *name, PyObject *value) { // Can't just call PyObject_GenericSetAttr because // we need to able to update the __str__ slot as well. PyTypeObject *type = reinterpret_cast(obj); type->tp_flags |= Py_TPFLAGS_HEAPTYPE; int result = PyType_Type.tp_setattro(obj, name, value); type->tp_flags &= ~Py_TPFLAGS_HEAPTYPE; return result; } ___ Python tracker <http://bugs.python.org/issue1229239> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1759845] subprocess.call fails with unicode strings in command line
Greg Couch added the comment: I like the C patch better. It only tries to decode non-unicode objects with the filesystem (mbcs) encoding. This fits in with Python 3.0 perfectly where all strings are unicode. In 2.5, strings are assumed to be in the mbcs encoding, to match the Windows ANSI API, so decoding those with the mbcs encoding shouldn't alter the set of acceptable strings (which is what the C patch is doing if I read the code correctly). -- ___ Python tracker <http://bugs.python.org/issue1759845> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6270] Menu deletecommand fails if command is already deleted
New submission from Greg Couch : Sometime around Python 2.5.4, Menu.delete was changed to delete associated entry commands (and thus plug a memory leak). This broke Pmw.OptionMenu because it already had similar code, so when Menu.delete was called, the commands were already gone, and a TclError was raised saying "can't delete Tcl command". While Pmw could be patched to workaround this bug, it seems strange that Tkinter.Misc.deletecommand unconditionally deletes commands it knows nothing about. All uses of deletecommand in Tkinter refer to commands that were Tkinter.Misc._register'ed, so they should appear in the widget._tclCommands list. So the proper solution is to only delete commands that are still registered with the widget. Repeat by: import Pmw om = Pmw.OptionMenu() om.pack() om.setitems(['a', 'b']) om.setitems(['b']) -- components: Tkinter files: delcmd.patch keywords: patch messages: 89262 nosy: gregcouch severity: normal status: open title: Menu deletecommand fails if command is already deleted type: crash versions: Python 2.5, Python 2.6, Python 2.7, Python 3.0, Python 3.1 Added file: http://bugs.python.org/file14265/delcmd.patch ___ Python tracker <http://bugs.python.org/issue6270> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6270] Menu deletecommand fails if command is already deleted
Changes by Greg Couch : Added file: http://bugs.python.org/file14266/delcmd.patch ___ Python tracker <http://bugs.python.org/issue6270> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6270] Menu deletecommand fails if command is already deleted
Changes by Greg Couch : Removed file: http://bugs.python.org/file14265/delcmd.patch ___ Python tracker <http://bugs.python.org/issue6270> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1759845] subprocess.call fails with unicode strings in command line
Greg Couch added the comment: So Terry, can you reopen this bug then? It's not out of date. -- ___ Python tracker <http://bugs.python.org/issue1759845> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue734176] Make Tkinter.py's nametowidget work with cloned menu widgets
Greg Couch added the comment: We still apply that patch to the Python that we embed in our application and have for the last 10 years :-) -- ___ Python tracker <http://bugs.python.org/issue734176> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com