[issue14367] try/except block in ismethoddescriptor() in inspect.py, so that pydoc works with pygame in Python 3.2
Dave Burton ncdave4l...@gmail.com added the comment: Well, the exception is NotImplementedError. It's raised explicitly in pygame\__init__.py I uncommented my commented-out print statement in inspect.py, and added a traceback print, and ran pydoc like this: c:\python32\python.exe c:\python32\Lib\pydoc.py -p 7464 The I viewed http://localhost:7464/pygame.html in a web browser, and the pydoc server printed: Server ready at http://localhost:7464/ Server commands: [b]rowser, [q]uit server c:\python32\Lib\inspect.py:105: RuntimeWarning: use scrap: No module named scrap (ImportError: No module named scrap) result = (hasattr(object, __get__) dbg: ismethoddescriptor(pygame.MissingModule object at 0x03763F90) failed, exception=NotImplementedError('scrap module not available\n(ImportError: No module named scrap)',) Traceback (most recent call last): File c:\python32\Lib\inspect.py, line 105, in ismethoddescriptor result = (hasattr(object, __get__) File c:\python32\lib\site-packages\pygame\__init__.py, line 74, in __getattr__ raise NotImplementedError(MissingPygameModule) NotImplementedError: scrap module not available (ImportError: No module named scrap) c:\python32\Lib\inspect.py:105: RuntimeWarning: use sndarray: no module named numpy or Numeric found (ImportError: no module named numpy or Numeric found) result = (hasattr(object, __get__) dbg: ismethoddescriptor(pygame.MissingModule object at 0x0376EFF0) failed, exception=NotImplementedError('sndarray module not available\n(ImportError: no module named numpy or Numeric found)',) Traceback (most recent call last): ...(etc.) Here's the modified ismethoddescriptor() in inspect.py: def ismethoddescriptor(object): Return true if the object is a method descriptor. But not if ismethod() or isclass() or isfunction() are true. This is new in Python 2.2, and, for example, is true of int.__add__. An object passing this test has a __get__ attribute but not a __set__ attribute, but beyond that the set of attributes varies. __name__ is usually sensible, and __doc__ often is. Methods implemented via descriptors that also pass one of the other tests return false from the ismethoddescriptor() test, simply because the other tests promise more -- you can, e.g., count on having the __func__ attribute (etc) when an object passes ismethod(). import traceback try: result = (hasattr(object, __get__) and not hasattr(object, __set__) # else it's a data descriptor and not ismethod(object) # mutual exclusion and not isfunction(object) and not isclass(object)) except Exception as whichone: print('dbg: ismethoddescriptor('+repr(object)+') failed, exception='+repr(whichone)) traceback.print_exc(file=sys.stdout) print(-*60 + '\n') result = False return result -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14367 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14367] try/except block in ismethoddescriptor() in inspect.py, so that pydoc works with pygame in Python 3.2
Dave Burton ncdave4l...@gmail.com added the comment: expect? Did I type that?? Should be try/except, of course. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14367 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14367] try/except block in ismethoddescriptor() in inspect.py, so that pydoc works with pygame in Python 3.2
New submission from Dave Burton ncdave4l...@gmail.com: I noticed that pydoc doesn't work for pygame under python 3.2.1 or 3.2.2 for Win32; it just reports: NotImplementedError: scrap module not available (ImportError: No module named scrap) I made a small patch to inspect.py to solve the problem (I just added a try/expect around the failing statement in ismethoddescriptor). Here's the diff: http://www.burtonsys.com/python32/inspect.diff With that patch, pydoc works with pygame, and reports just a few pygame issues: *scrap* = pygame.MissingModule object *sndarray* = pygame.MissingModule object *surfarray* = pygame.MissingModule object -- components: Library (Lib) files: inspect.diff keywords: patch messages: 156314 nosy: ncdave4life priority: normal severity: normal status: open title: try/except block in ismethoddescriptor() in inspect.py, so that pydoc works with pygame in Python 3.2 type: behavior versions: Python 3.2 Added file: http://bugs.python.org/file24935/inspect.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14367 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9949] os.path.realpath on Windows does not follow symbolic links
Dave Burton ncdave4l...@gmail.com added the comment: It seems that the nt module is implemented in the posixmodule.c source file, and the Python 3 version contains the posix__getfinalpathname entry point, but the Python 2 version does not. I presume that PyWin32 could also be used to work around this. Too bad it isn't automatically included with Python: http://sourceforge.net/projects/pywin32/files/pywin32/Build%20217/ -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9949 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9949] os.path.realpath on Windows does not follow symbolic links
Dave Burton ncdave4l...@gmail.com added the comment: Excellent! The ntpath.py change is nearly identical in Python 2.7 to the change for Python 3.2. The only difference is that instead of: +elif isinstance(path, bytes): +path = os.getcwdb() It is: +elif isinstance(path, unicode): +path = os.getcwdu() -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9949 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9949] os.path.realpath on Windows does not follow symbolic links
Dave Burton ncdave4l...@gmail.com added the comment: This is a patch for the os.path.realpath() bug under Windows, http://bugs.python.org/issue9949 os.path.realpath on Windows does not follow symbolic links ntpath.diff fixes the realpath() function to resolve symbolic links to their targets (tested under Windows 7). Note: I tried to make the equivalent patch for Python 2.7, but it didn't work because the from nt import _getfinalpathname fails. -- nosy: +ncdave4life Added file: http://bugs.python.org/file24770/ntpath_fix_issue9949.zip ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9949 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com