weixin_39942191 2020-11-20 20:32
浏览 0

Periodically able to cause moved functions to fail delattr()

Originally reported by: Joshua Harlow (Bitbucket: harlowja, GitHub: harlowja)

When running a piece of threaded code that directly uses six.moves.$XYZ:

For example:

https://github.com/openstack/taskflow/blob/master/taskflow/examples/jobboard_produce_consume_colors.py

I am periodically able to trigger an unusually occurrence with-in six (it doesn't occur on every run, but once every ~20 runs of the above example).


#!python

Traceback (most recent call last):
  File "/usr/lib64/python2.7/threading.py", line 810, in __bootstrap_inner
    self.run()
  File "/usr/lib64/python2.7/threading.py", line 763, in run
    self.__target(*self.__args, **self.__kwargs)
  File "taskflow/examples/jobboard_produce_consume_colors.py", line 140, in producer
    for i in six.moves.xrange(0, PRODUCER_UNITS):
  File "/home/josh/Dev/taskflow/.tox/py27/lib/python2.7/site-packages/six.py", line 90, in __get__
    delattr(obj.__class__, self.name)
AttributeError: xrange

Is it possible for the six.moves.xrange attribute to disappear somehow when running from daemon threads (although those daemon threads are joined on by the parent). Perhaps there is some underlying issue with the above six code?

This is with six==1.7.3 (if that matters).

Full environment @ http://paste.ubuntu.com/8495305/

  • Bitbucket: https://bitbucket.org/gutworth/six/issue/98

该提问来源于开源项目:benjaminp/six

  • 写回答

9条回答 默认 最新

  • weixin_39942191 2020-11-20 20:32
    关注

    Merged in harlowja/six/fix-delattr (pull request #54)

    Fix issue #98

    评论

报告相同问题?