[PEAK] Re: Trellis + Python 2.6

Sergey Schetinin maluke at gmail.com
Thu Nov 20 02:42:11 EST 2008


Here's an updated patch. Set worked well in my tests, so I'm pretty
confident about it. It had to copy with some changes quite a few lines
from sets.Set, but not too many.

I tried running the test suite but it fails completely:

Traceback (most recent call last):
  File "setup.py", line 40, in <module>
    py_modules = ['_threading_local'][:sys.version<'2.4']
  File "C:\python26\lib\distutils\core.py", line 152, in setup
    dist.run_commands()
  File "C:\python26\lib\distutils\dist.py", line 975, in run_commands
    self.run_command(cmd)
  File "C:\python26\lib\distutils\dist.py", line 995, in run_command
    cmd_obj.run()
  File "build\bdist.win32\egg\setuptools\command\test.py", line 121, in run
  File "build\bdist.win32\egg\setuptools\command\test.py", line 101,
in with_project_on_sys_path
  File "build\bdist.win32\egg\setuptools\command\test.py", line 135,
in run_tests
  File "C:\python26\lib\unittest.py", line 817, in __init__
    self.runTests()
  File "C:\python26\lib\unittest.py", line 861, in runTests
    result = testRunner.run(self.test)
AttributeError: 'NoneType' object has no attribute 'run'






There are a few more changes in this patch that I'd really like to see
in trunk, which I'll explain here:

-                raise InputConflict(self._value, value)
#self._set_by) #, value, ctrl.current_listener) # XXX
+                raise InputConflict(self._value, value, self._set_by,
ctrl.current_listener) # XXX

InputConflict is pretty useless otherwise. Not sure why it's commented out.

-    def wrap(__func, __module):
-        """
+    def wrap(__func, __module): pass
+    wrap.__doc__ = """

I requested a few similar changes a few months ago, but it was
declined and for a good reason. I'm asking again about this because I
found out this is the only place I can't monkeypatch on import because
@modifier is used in the module itself. So I can monkeypatch
decorators.rewrap, but not this. The reason I need to distribute apps
with -OO is exactly because it strips docstrings which makes
proprietary code a bit harder to reverse-engineer and because it cuts
distribution size noticeably, by almost 10%. If there's a way to patch
modules before fully imported, that would be good enough for me, but
there's apparently no way to do that.

-            raise AssertionError("This should never happen!")
+            raise AssertionError("This should never happen!", self)

Again, pretty useless without knowing the cell.

The rest of changes are for py2.6 compatibility and shouldn't
influence earlier versions at all.


On Wed, Nov 19, 2008 at 05:52, Phillip J. Eby <pje at telecommunity.com> wrote:
> At 01:05 AM 11/19/2008 +0200, Sergey Schetinin wrote:
>>
>> I'll have to look into using collections.MutableSet, but I won't have
>> any time for this for a few days. Will report when done.
>
> That would require a pretty substantial rewrite, which then wouldn't work
> with any version less than 2.6.  (The collections abstract bases don't
> delegate operations to a ._data member.)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: py26.patch
Type: application/octet-stream
Size: 10265 bytes
Desc: not available
Url : http://www.eby-sarna.com/pipermail/peak/attachments/20081120/e93a9c02/py26.obj


More information about the PEAK mailing list