[issue45520] Frozen dataclass deep copy doesn't work with __slots__
Justin Furuness added the comment: Thank you for the in-depth explanation. That all makes sense to me, I have run into the __slots__ with defaults issues before, I'll be sure to try out these fixes. I appreciate you taking the time. Thanks, Justin On Tue, Oct 19, 2021 at 5:28 PM Josh Rosenberg wrote: > > Josh Rosenberg added the comment: > > You're right that in non-dataclass scenarios, you'd just use __slots__. > > The slots=True thing was necessary for any case where any of the > dataclass's attributes have default values (my_int: int = 0), or are > defined with fields (my_list: list = field(default_factory=list)). The > problem is that __slots__ is implemented by, after the class definition > ends, creating descriptors on the class to access the data stored at known > offsets in the underlying PyObject structure. Those descriptors themselves > being class attributes means that when the type definition machinery tries > to use __slots__ to create them, it finds conflicting class attributes (the > defaults/fields) that already exist and explodes. > > Adding support for slots=True means it does two things: > > 1. It completely defines the class without slots, extracts the stuff it > needs to make the dataclass separately, then deletes it from the class > definition namespace and makes a *new* class with __slots__ defined (so no > conflict occurs) > 2. It checks if the dataclass is also frozen, and applies alternate > __getstate__/__setstate__ methods that are compatible with a frozen, > slotted dataclass > > #2 is what fixes this bug (while #1 makes it possible to use the full > range of dataclass features without sacrificing the ability to use > __slots__). If you need this to work in 3.9, you could borrow the 3.10 > implementations that make this work for frozen dataclasses to explicitly > define __getstate__/__setstate__ for your frozen slotted dataclasses: > > def __getstate__(self): > return [getattr(self, f.name) for f in fields(self)] > > > def __setstate__(self, state): > for field, value in zip(fields(self), state): > # use setattr because dataclass may be frozen > object.__setattr__(self, field.name, value) > > I'm not closing this since backporting just the fix for frozen slotted > dataclasses (without backporting the full slots=True functionality that's a > new feature) is possibly within scope for a bugfix release of 3.9 (it > wouldn't change the behavior of working code, and fixes broken code that > might reasonably be expected to work). > > -- > > ___ > Python tracker > <https://bugs.python.org/issue45520> > ___ > -- ___ Python tracker <https://bugs.python.org/issue45520> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue45520] Frozen dataclass deep copy doesn't work with __slots__
Justin Furuness added the comment: I didn't realize it was possible to add slots in that way (slots=True). I think for normal classes manually defining __slots__ is the common way of adding __slots__ (at least for me), so it feels weird to me that manually defining __slots__ instead of adding slots=True produces different behaviour. That being said, no strong motivation to change it, this fixes my issue, feel free to close this. Thanks, Justin On Mon, Oct 18, 2021 at 9:25 PM Josh Rosenberg wrote: > > Josh Rosenberg added the comment: > > When I define this with the new-in-3.10 slots=True argument to dataclass > rather than manually defining __slots__ it works just fine. Looks like the > pickle format changes rather dramatically to accommodate it. > > >>> @dataclass(frozen=True, slots=True) > ... class FrozenData: > ... my_string: str > ... > >>> deepcopy(FrozenData('initial')) > FrozenData(my_string='initial') > > Is there a strong motivation to support manually defined __slots__ on top > of slots=True that warrants fixing it for 3.10 onward? > > -- > nosy: +josh.r > > ___ > Python tracker > <https://bugs.python.org/issue45520> > ___ > -- ___ Python tracker <https://bugs.python.org/issue45520> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43758] dict.config TimedRotatingFileHandler filename .suffix does not function
New submission from Justin Lee : Hi, I would like to change the .suffix for the TimedRotatingFileHandler for the "future-created" file in dictConfig written in json. Is there any suggestion on how to do that? -- messages: 390400 nosy: tea940314 priority: normal severity: normal status: open title: dict.config TimedRotatingFileHandler filename .suffix does not function type: enhancement versions: Python 3.9 ___ Python tracker <https://bugs.python.org/issue43758> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue42695] tkinter keysym_num value is incorrect
Justin added the comment: TK bug ticket has been created at https://core.tcl-lang.org/tk/tktview/ffe6925b916caac02acae53f745e95dd1c557019 -- ___ Python tracker <https://bugs.python.org/issue42695> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue42695] tkinter keysym_num value is incorrect
New submission from Justin : Hi there. On my MacOS 10.14.16 laptop with a qwerty keyboard I was testing tkinter keyboard listening for an azerty keyboard layout by switching the layout to `French - PC` When I press qwerty keys Shift + \ I expect to see 'μ' printed. When looking at the tkinter events for that key press we see: ``` down {'keysym': 'Shift_L', 'keysym_num': 65505, 'keycode': 131072, 'char': ''} down {'keysym': 'tslash', 'keysym_num': 956, 'keycode': 956, 'char': 'μ'} up {'keysym': 'asterisk', 'keysym_num': 42, 'keycode': 2753468, 'char': 'μ'} up {'keysym': 'Shift_L', 'keysym_num': 65505, 'keycode': 131072, 'char': ''} ``` So the char value is correct but the keysym_num is not the expected 181 for mu. Comparing this to pressing Shift + / to generate the section symbol (§) we see: ``` down {'keysym': 'Shift_L', 'keysym_num': 65505, 'keycode': 131072, 'char': ''} down {'keysym': 'section', 'keysym_num': 167, 'keycode': 167, 'char': '§'} up {'keysym': 'section', 'keysym_num': 167, 'keycode': 2883751, 'char': '§'} up {'keysym': 'Shift_L', 'keysym_num': 65505, 'keycode': 131072, 'char': ''} ``` Which produces the expected keysym_num of 167. TLDR: the kysym_num value when writing the mu character is incorrect. It should be 181 and logging shows values of 956 and 42. Can this be fixed? Here is the keyboard listener program which can be used for verification: ``` from tkinter import * params = ['keysym', 'keysym_num', 'keycode', 'char'] def keyup(e): d = {p: getattr(e, p) for p in params} print('up', d) # print('up', e.__dict__) def keydown(e): d = {p: getattr(e, p) for p in params} print('down', d) # print('down', e.__dict__) pass root = Tk() frame = Frame(root, width=100, height=100) frame.bind("", keydown) frame.bind("", keyup) frame.pack() frame.focus_set() root.mainloop() ``` Note: my python version was installed from python.org and is: ``` Python 3.9.1 (v3.9.1:1e5d33e9b9, Dec 7 2020, 12:44:01) [Clang 12.0.0 (clang-1200.0.32.27)] on darwin ``` -- messages: 383458 nosy: spacether priority: normal severity: normal status: open title: tkinter keysym_num value is incorrect ___ Python tracker <https://bugs.python.org/issue42695> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue42640] tkinter throws exception when key is pressed
Justin added the comment: Thank you very much. I understand and just wanted to let you know. In brew I opened up this ticket(https://github.com/Homebrew/homebrew-core/issues/67327) with that team. -- ___ Python tracker <https://bugs.python.org/issue42640> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue42640] tkinter throws exception when key is pressed
Justin added the comment: FYI, I just brew installed python and with: ``` Python 3.9.1 (default, Dec 17 2020, 03:56:09) [Clang 11.0.0 (clang-1100.0.33.17)] on darwin ``` This issue still happens -- ___ Python tracker <https://bugs.python.org/issue42640> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue42640] tkinter throws exception when key is pressed
Justin added the comment: Thanks for responding so quickly. 1. My python version is: Python 3.8.6 (default, Oct 8 2020, 14:07:53) [Clang 11.0.0 (clang-1100.0.33.17)] on darwin 2. N/A 3. >>> from tkinter.test.support import * >>> get_tk_patchlevel() (8, 5, 9, 'final', 0) 4. No; the pygame sample does not crash with this key input Which version of TK 8.5.X fixes this, 8.5.18.0? That's what it looks like here: https://www.python.org/download/mac/tcltk/ -- ___ Python tracker <https://bugs.python.org/issue42640> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue42640] tkinter throws exception when key is pressed
Justin added the comment: Sorry my verification keyboard listener program is not the pygame one. It is this one: ``` from tkinter import * def keyup(e): print('up', e.__dict__) def keydown(e): print('down', e.__dict__) root = Tk() frame = Frame(root, width=100, height=100) frame.bind("", keydown) frame.bind("", keyup) frame.pack() frame.focus_set() root.mainloop() ``` -- ___ Python tracker <https://bugs.python.org/issue42640> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue42640] tkinter throws exception when key is pressed
New submission from Justin : On macOs 10.14.6 laptop with a qwerty layout, when I switch my keyboard layout to `French - PC` and use a tkinter keyboard listener and press the '[' button which should be the '^' button on the azerty keyboard, this Error is thrown: ``` 2020-12-14 10:13:26.533 Python[14880:1492926] *** Terminating app due to uncaught exception 'NSRangeException', reason: '-[__NSCFConstantString characterAtIndex:]: Range or index out of bounds' *** First throw call stack: ( 0 CoreFoundation 0x7fff41ce49ad __exceptionPreprocess + 256 1 libobjc.A.dylib 0x7fff6c3dfa17 objc_exception_throw + 48 2 CoreFoundation 0x7fff41ce47df +[NSException raise:format:] + 201 3 CoreFoundation 0x7fff41c5a159 -[__NSCFString characterAtIndex:] + 102 4 Tk 0x7fff4da8a806 TkpInitKeymapInfo + 719 5 Tk 0x7fff4da905e9 Tk_MacOSXSetupTkNotifier + 793 6 Tcl 0x7fff4d98c48e Tcl_DoOneEvent + 301 7 _tkinter.cpython-38-darwin.so 0x0001090802de _tkinter_tkapp_mainloop + 342 8 Python 0x000108ac1b0a method_vectorcall_FASTCALL + 250 9 Python 0x000108b5a299 call_function + 346 10 Python 0x000108b51457 _PyEval_EvalFrameDefault + 3895 11 Python 0x000108b5ae5d _PyEval_EvalCodeWithName + 2107 12 Python 0x000108abad39 _PyFunction_Vectorcall + 217 13 Python 0x000108abcc7d method_vectorcall + 135 14 Python 0x000108b5a299 call_function + 346 15 Python 0x000108b51477 _PyEval_EvalFrameDefault + 3927 16 Python 0x000108b5ae5d _PyEval_EvalCodeWithName + 2107 17 Python 0x000108b5047d PyEval_EvalCode + 51 18 Python 0x000108b89025 run_eval_code_obj + 102 19 Python 0x000108b88473 run_mod + 82 20 Python 0x000108b87345 PyRun_FileExFlags + 160 21 Python 0x000108b86a29 PyRun_SimpleFileExFlags + 271 22 Python 0x000108b9e449 Py_RunMain + 1870 23 Python 0x000108b9e790 pymain_main + 306 24 Python 0x000108b9e7de Py_BytesMain + 42 25 libdyld.dylib 0x7fff6dbae3d5 start + 1 26 ??? 0x0002 0x0 + 2 ) libc++abi.dylib: terminating with uncaught exception of type NSException Abort trap: 6 ``` One can verify this by running this program on a macOs laptop with a qwerty keyboard, switching the layout to French - PC and pressing the '[' key. ``` import pygame pygame.init() pygame.display.set_mode((100, 100)) while True: for event in pygame.event.get(): if event.type == pygame.QUIT: pygame.quit(); #sys.exit() if sys is imported if event.type == pygame.KEYDOWN: key_name = pygame.key.name(event.key) print(event, event.key.__class__, event.key, key_name) elif event.type == pygame.KEYUP: key_name = pygame.key.name(event.key) print(event, event.key.__class__, event.key, key_name) ``` ``` -- messages: 382998 nosy: spacether priority: normal severity: normal status: open title: tkinter throws exception when key is pressed ___ Python tracker <https://bugs.python.org/issue42640> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13337] IGNORE_CASE doctest option flag
Change by Justin Baum : -- keywords: +patch nosy: +justinba1010 nosy_count: 3.0 -> 4.0 pull_requests: +22426 stage: -> patch review pull_request: https://github.com/python/cpython/pull/23547 ___ Python tracker <https://bugs.python.org/issue13337> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue42140] asyncio.wait function creates futures set two times
Justin Arthur added the comment: > So the behaviour you describe will happen anyway. Unless we make your change against the 3.9 branch, in which case the fix will make it into the 3.9.x series of patch releases. -- ___ Python tracker <https://bugs.python.org/issue42140> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue42140] asyncio.wait function creates futures set two times
Justin Arthur added the comment: I believe the documentation may be referring to the English set and not a Python set, but I could be wrong. Yury changed the wording from sequence to set in 3.7, but we didn't document a breaking change as far as I know. The purpose of those set constructions was to handle the many things other than a set that can be passed in that may have non-unique values. Early asyncio documentation included examples of passing wait() a list. I wouldn't be surprised if there are other libraries or apps out there for which removing iterator support was an accidentally-breaking change and it may be strange if this is only is broken in 3.9.x, but working both before and after. -- ___ Python tracker <https://bugs.python.org/issue42140> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue42140] asyncio.wait function creates futures set two times
Justin Arthur added the comment: Your change makes perfect sense to me. It would be a backport-only change as the 2nd set creation is actually getting removed for the development version (3.10) to finalize the deprecation of wait's coroutine scheduling. -- nosy: +JustinTArthur ___ Python tracker <https://bugs.python.org/issue42140> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38912] test_asyncio altered the execution environment
Justin Arthur added the comment: The "'NoneType' object has no attribute 'close'" error is likely caused by a race against the loop calling the test protocol object's connection_made callback. I was able to reproduce this case occasionally on macOS and it's likely platform-agnostic. Given server/connection cleanup isn't context-managed or finally-driven on the affected tests, raising the NoneType error will skip cleanup and we see additional exceptions from unclosed networking components being garbage collected. Tests using this test protocol pattern were either waiting for the callback already or were waiting on network i/o that happens long after connection establishment with the exception of: - `test_create_server_ssl_verified` - `test_create_unix_server_ssl_verified` PR 22691 ensures those two tests wait for the connect callbacks as well. This may not address the env changed error from recent msg378481, as the initial error is not necessarily disclosed in that log. -- ___ Python tracker <https://bugs.python.org/issue38912> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38912] test_asyncio altered the execution environment
Change by Justin Arthur : -- nosy: +JustinTArthur nosy_count: 5.0 -> 6.0 pull_requests: +21662 pull_request: https://github.com/python/cpython/pull/22691 ___ Python tracker <https://bugs.python.org/issue38912> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue33533] Provide an async iterator version of as_completed
Change by Justin Arthur : -- versions: +Python 3.10 -Python 3.8 ___ Python tracker <https://bugs.python.org/issue33533> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue33533] Provide an async iterator version of as_completed
Change by Justin Arthur : -- title: Provide an async-generator version of as_completed -> Provide an async iterator version of as_completed ___ Python tracker <https://bugs.python.org/issue33533> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue33533] Provide an async-generator version of as_completed
Justin Arthur added the comment: Thanks, Hrvoje. I've updated the patch to match this bug's suggested format and have updated the documentation and What's New. The one quirk that comes with the benefit of getting the same futures back is that we still allow both coroutines and futures to be passed in. Coroutines will not be yielded back in their original form, but instead a new task. -- ___ Python tracker <https://bugs.python.org/issue33533> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38032] lib2to3 doesn't parse Python 3 identifiers containing non-spacing marks
Justin Arthur added the comment: Not sure if there is consensus on how to fix, but fixing #12731 will fix this for most of the cases I've seen complaints about as a side effect. -- ___ Python tracker <https://bugs.python.org/issue38032> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue33533] Provide an async-generator version of as_completed
Justin Arthur added the comment: I've added a new PR, PR 22491. This one has as_completed returning an iterator and includes tests for both the old and new style. I see a trivial amount of latency added in extra call stack over Guido's original implementation. Should we decide to deprecate the plain-iterator-of-awaitables form, we can possibly regain that latency in refactoring this as an asynchronous generator. -- ___ Python tracker <https://bugs.python.org/issue33533> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue33533] Provide an async-generator version of as_completed
Change by Justin Arthur : -- nosy: +JustinTArthur nosy_count: 5.0 -> 6.0 pull_requests: +21508 pull_request: https://github.com/python/cpython/pull/22491 ___ Python tracker <https://bugs.python.org/issue33533> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue41337] strangnedd with the parser
New submission from Justin Hodder : Here a colab that demostrates the bug https://colab.research.google.com/drive/1OWSEoV7Wx-EBA_2IprNZoASNvXIky3iC?usp=sharing the following code gives"received an invalid combination of arguments - got (Tensor, Tensor), but expected one of:" import torch torch.nn.Linear( torch.as_strided(torch.ones((4,6*5*5*70*10)),(4,6*5*5,10),(4,2,-1)) ,torch.ones(10,6*5*6)) #(4,2,3),(2,3,1)) The following code gives "TypeError: ones(): argument 'size' (position 1) must be tuple of ints, not str import torch" import torch #torch.nn.Linear( torch.as_strided(torch.ones((4,6*5*5*70*10)),(4,6*5*5,10),(4,2,-1)) ,torch.ones(10,6*5*6)#) #(4,2,3),(2,3,1)) -- components: Interpreter Core files: pythos_parser_bug.ipynb messages: 373937 nosy: Justin Hodder priority: normal severity: normal status: open title: strangnedd with the parser versions: Python 3.6 Added file: https://bugs.python.org/file49325/pythos_parser_bug.ipynb ___ Python tracker <https://bugs.python.org/issue41337> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40078] asyncio subprocesses allow pids to be reaped, different behavior than regular subprocesses
Change by Justin Lebar : -- type: -> behavior versions: +Python 3.9 ___ Python tracker <https://bugs.python.org/issue40078> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40078] asyncio subprocesses allow pids to be reaped, different behavior than regular subprocesses
Change by Justin Lebar : -- versions: +Python 3.7, Python 3.8 ___ Python tracker <https://bugs.python.org/issue40078> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1187312] subprocess: optional auto-reaping fixing os.wait() lossage
Justin Lebar added the comment: 15 years later, it seems asyncio subprocesses may have the same issue. :) https://bugs.python.org/issue40078 -- nosy: +Justin.Lebar ___ Python tracker <https://bugs.python.org/issue1187312> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40078] asyncio subprocesses allow pids to be reaped, different behavior than regular subprocesses
New submission from Justin Lebar : >From https://bugs.python.org/issue1187312 about regular subprocesses: > So as long as the application keeps a reference to the > subprocess object, it can wait for it; auto-reaping only > starts when the last reference was dropped [in Popen.__del__]. asyncio subprocesses seem to behave differently. When we notice the process has exited in BaseSubprocessTransport._process_exited, we call _try_finish(), which -- if all pipes are closed -- calls _call_connection_lost and sets self._proc to None. At this point, my understanding is that once self._proc is GC'ed, we'll run Popen.__del__ and may reap the pid. I would expect asyncio subprocesses to behave the same way as regular Popen objects wrt pid reaping. -- components: asyncio messages: 365095 nosy: Justin.Lebar, asvetlov, yselivanov priority: normal severity: normal status: open title: asyncio subprocesses allow pids to be reaped, different behavior than regular subprocesses ___ Python tracker <https://bugs.python.org/issue40078> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38860] GenericPyCData_new does not invoke new or init
Justin Capella added the comment: Becca were you still interested in this issue? Anyone agree the unit test seems to have a bug if that is intended behavior? Is there a better forum for discussion about design/behavior, maybe the more generic issue of GenericPyCData_new using tp_alloc instead of tp_new -- ___ Python tracker <https://bugs.python.org/issue38860> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39175] Funkness with issubset
Justin Hodder added the comment: AttributeError: 'tuple' object has no attribute 'issubset' And it doesn't explain why it works as expected in Brython. -- ___ Python tracker <https://bugs.python.org/issue39175> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39175] Funkness with issubset
Justin Hodder added the comment: oh I'm using Python 3.8.1 (32-bit) 3.8.1150.0 on win10 -- ___ Python tracker <https://bugs.python.org/issue39175> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39175] Funkness with issubset
Justin Hodder added the comment: This works: $ diff PythonDoesntWorks.py HowCanYouPayMana.v3.py 60c60 < if x2.issubset(set(avalMana.keys())): --- > if x2.issubset(set(list(avalMana.keys(: 62a63 > this doesn't work: $ diff PythonDoesntWorks.py HowCanYouPayMana.v3.py 60c60 < if x2.issubset(set(avalMana.keys())): --- > if x2.issubset(set(list(avalMana.keys(: 62a63 > print("cost",cost) -- ___ Python tracker <https://bugs.python.org/issue39175> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39175] Funkness with issubset
New submission from Justin Hodder : line 59,"print(x2,"avalMana",set(avalMana.keys()))" prints:"{('A', 'B')} avalMana {'A', ('A', 'B'), ('A', 'C')}" line 60,"if x2.issubset(set(avalMana.keys())):" is False change line 60 to "if x2.issubset(set(list(avalMana.keys(:" and it works as expected. -- components: Interpreter Core files: PythonDoesntWorks.py messages: 359137 nosy: Justin Hodder priority: normal severity: normal status: open title: Funkness with issubset type: behavior versions: Python 3.8 Added file: https://bugs.python.org/file48814/PythonDoesntWorks.py ___ Python tracker <https://bugs.python.org/issue39175> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38860] GenericPyCData_new does not invoke new or init
Justin Capella added the comment: It might make sense that CSimpleData types do not call init, which makes sense for _fields_ but it doesn't make sense to offer subclassing (of Structure) and not use the subclass, instead creating a type of the same name. That test case is bugged, missing an underscore... The git blame wasn't "available" for that particular test but I would argue that it's testing for undocumented behavior :p I wanted to be able to do assertions/initialization, I'm sure other people have expected from_buffer(_copy) et al would act as a class method, returning an instance of the subclass. More generally, I think that GenericPyCData_new should not "tp_alloc"... What's _new about that? My guess is there was at some level desire to "optimize" ctypes. If that does turn out to be the case I'd hope for a "unsimple" CData and ask that Structure be an instance of that. Either way docs reflecting the behavior to Structure would be nice, I just hope it includes "prior to version" :p thanks for taking a look -- ___ Python tracker <https://bugs.python.org/issue38860> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38576] CVE-2019-18348: CRLF injection via the host part of the url passed to urlopen()
Justin Capella added the comment: Can't see the specifics of that "restricted" redhat bug, but this was interesting bug and I wanted to ask if perhaps the domain in such cases should be IDN / punycoded ://xn--n28h.ws/ for example is ://.la -- nosy: +b1tninja ___ Python tracker <https://bugs.python.org/issue38576> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38860] GenericPyCData_new does not invoke new or init
New submission from Justin Capella : When subclassing the ctypes.Structure class, __new__ and __init__ are not invoked when using the inherited classmethod from_buffer_copy to create the object. I think this is because tp_alloc is ultimately used by GenericPyCData_new when creating the object using the from_buffer_copy classmethod inherited from _CData. https://github.com/python/cpython/blob/be143ec99674ba38c5811f34cdb85ef39c2dc8f8/Modules/_ctypes/_ctypes.c#L3202 Expected behavior: creation of Structure subclass object would invoke __new__ and possibly __init__. -- components: ctypes files: ctypesnew.py messages: 357022 nosy: b1tninja priority: normal severity: normal status: open title: GenericPyCData_new does not invoke new or init type: behavior versions: Python 2.7, Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 3.9 Added file: https://bugs.python.org/file48723/ctypesnew.py ___ Python tracker <https://bugs.python.org/issue38860> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38166] ast identifies incorrect column for compound attribute lookups
New submission from Justin McCann : This issue is related to https://github.com/microsoft/vscode-python/issues/7327 and https://github.com/PyCQA/pylint/issues/3103 For compound attribute access in variable references like a.b.c.d, the AST reports the column of the first variable/attribute in the sequence instead of the specific attribute location. For example, the location of c is reported as column 0 (a) and not column 4 (c). Here's the AST test case provided by a pylint developer in a comment on pylint issue 3103; I confirmed the behavior is the same in python 3.8.0b4. ``` $ python3.8 Python 3.8.0b4 (v3.8.0b4:d93605de72, Aug 29 2019, 21:47:47) [Clang 6.0 (clang-600.0.57)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import ast >>> body = ast.parse(''' ... print(x.item.akey > 2) ... ''') >>> # x.item ... x_item = body.body[0].value.args[0].left.value >>> print(x_item, x_item.attr, x_item.col_offset) <_ast.Attribute object at 0x10a7751f0> item 6 >>> # x.item.akey ... print(x_item.value, x_item.value.col_offset) . ### probably should be 8 <_ast.Name object at 0x10a775280> 6 ``` Related issues: * https://bugs.python.org/issue1440601 Add col information to parse & ast nodes * https://bugs.python.org/issue10769 ast: provide more useful range information Here is the resulting confusion when you use this output in pylint (and then VSCode highlights only "x" since it's the variable that starts in column 0): Original pylint/vscode testcase: ``` class TestMe: def __init__(self): self.item = {'akey': 42} self.again = self x = TestMe() ### pylint error message here is ###testme.py:11:6: E1101: Instance of 'dict' has no 'akey' member (no-member) ### The problem is with `x.item`, but pylint shows the column for `x` print(x.item.akey > 2) print(x.again.item.doesnotexist) ``` Current behavior $ pylint testme.py -rn -sn * Module testme testme.py:10:6: E1101: Instance of 'dict' has no 'akey' member (no-member) testme.py:12:6: E1101: Instance of 'dict' has no 'doesnotexist' member (no-member) Expected behavior $ pylint testme.py -rn -sn * Module testme testme.py:10:8: E1101: Instance of 'dict' has no 'akey' member (no-member) testme.py:12:14: E1101: Instance of 'dict' has no 'doesnotexist' member (no-member) $ pylint --version output pylint 2.3.1 astroid 2.2.5 Python 3.7.4 (default, Jul 9 2019, 18:13:23) [Clang 10.0.1 (clang-1001.0.46.4)] -- components: Library (Lib) messages: 352393 nosy: Justin McCann priority: normal severity: normal status: open title: ast identifies incorrect column for compound attribute lookups type: behavior versions: Python 3.7, Python 3.8 ___ Python tracker <https://bugs.python.org/issue38166> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12731] python lib re uses obsolete sense of \w in full violation of UTS#18 RL1.2a
Change by Justin Arthur : -- nosy: +JustinTArthur ___ Python tracker <https://bugs.python.org/issue12731> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38032] lib2to3 doesn't parse Python 3 identifiers containing non-spacing marks
Justin Arthur added the comment: Ned, can you confirm that 2to3 is not intended for cumulative/incremental runs over the same codebase? If it's not intended to be run on previously ported code, this will just need to be fixed on the lib2to3 downstream projects like awpa and Black that are encountering this issue. -- ___ Python tracker <https://bugs.python.org/issue38032> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38032] lib2to3 doesn't parse Python 3 identifiers containing non-spacing marks
New submission from Justin ARthur : Python 3 code with an identifier that has a non-spacing mark in it does not get tokenized by lib2to3 and will result in an exception thrown in the parsing process. Parsing the attached file (badvar.py), results in `ParseError: bad token: type=58, value='̇', context=('', (1, 1))` This happens because the Name pattern regular expression in lib2to3 is `r'\w+'` and the word character class doesn't contain non-spacing marks (and possible other [continuation characters allowed in Python 3 identifiers](https://docs.python.org/3/reference/lexical_analysis.html#identifiers)). (reported by energizer in the Python IRC channel) -- components: 2to3 (2.x to 3.x conversion tool), Library (Lib) files: badvar.py messages: 351153 nosy: JustinTArthur priority: normal severity: normal status: open title: lib2to3 doesn't parse Python 3 identifiers containing non-spacing marks versions: Python 3.5, Python 3.6, Python 3.7, Python 3.8 Added file: https://bugs.python.org/file48592/badvar.py ___ Python tracker <https://bugs.python.org/issue38032> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue37372] datetime.time unpickling fails in case of python2 pickle with seconds>=24
New submission from Justin Blanchard : Under bpo-22005, Python 3 gained support for unpickling datetime data from Python 2. (Thanks!) It turns out the input validation isn't quite right: it bombs on datetime.time when the encoded seconds (not hours) field is >=24: python2>>> datetime.time(1, 2, 3).__reduce__() (, ('\x01\x02\x03\x00\x00\x00',)) python2>>> datetime.time(23, 24, 25).__reduce__() (, ('\x17\x18\x19\x00\x00\x00',)) python3>>> datetime.time('\x01\x02\x03\x00\x00\x00') datetime.time(1, 2, 3) python3>>> datetime.time('\x17\x18\x19\x00\x00\x00') Traceback (most recent call last): File "", line 1, in TypeError: an integer is required (got type str) I would like to contribute a fix and will be opening a PR. This is my first contribution - any help and patience appreciated! -- components: Library (Lib) messages: 346284 nosy: Justin Blanchard priority: normal severity: normal status: open title: datetime.time unpickling fails in case of python2 pickle with seconds>=24 type: behavior versions: Python 3.6, Python 3.7, Python 3.8, Python 3.9 ___ Python tracker <https://bugs.python.org/issue37372> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue37086] time.sleep error message misleading
Justin Fay added the comment: >From looking at the code for this (note I am not a C programmer so may have >gotten this wrong) _PyTime_FromObject first checks if the object is a float >using PyFloat_Check(obj) this is evident as passing nan to time.sleep raises a >ValueError with the message "Invalid value NaN (not a number)". However if the >object is not a float it next assumes the only valid value to be an integer, >this logic appears fine to me. The problem however is if the object is not an >integer the code raises the error with the message that an integer is >required, it is unaware that a before this branch of the code executes a float >would have been an accepted value. In python I imagine the fix for this would >be along the lines try: float(obj) except (TypeError, ValueError): try: int(obj): except (TypeError, ValueError): raise TypeError('an float or integer is required') -- ___ Python tracker <https://bugs.python.org/issue37086> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue37086] time.sleep error message misleading
New submission from Justin Fay : Using python3.6 and calling `time.sleep` with an invalid argument the `TypeError` raised has the error message "TypeError: an integer is required". This is not the case as a float or integer is acceptable. Using python 2.7 the error message given is better "TypeError: a float is required". -- messages: 343880 nosy: Justin Fay priority: normal severity: normal status: open title: time.sleep error message misleading versions: Python 3.6 ___ Python tracker <https://bugs.python.org/issue37086> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue36931] json lib doesnt want to load from file
New submission from Justin Rose : when I run the included file i get an error that looks like: Traceback (most recent call last): File "/home/justin/Desktop/pkmn/main.py", line 10, in expansion = json.load(expan_list) File "/usr/lib/python3.6/json/__init__.py", line 296, in load return loads(fp.read(), AttributeError: 'str' object has no attribute 'read' dont know what to make of it -- components: Extension Modules files: main.py messages: 342609 nosy: Justin Rose priority: normal severity: normal status: open title: json lib doesnt want to load from file type: resource usage versions: Python 3.6 Added file: https://bugs.python.org/file48331/main.py ___ Python tracker <https://bugs.python.org/issue36931> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35531] xml.etree.ElementTree Elment.find bug, fails to find tag
Justin added the comment: Issue was user error. I though that find did a full search of the tree when it only searches children. Solution is: ele = xml.find('.//faultstring') -- resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue35531> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35531] xml.etree.ElementTree Elment.find bug, fails to find tag
New submission from Justin : When the following text it loaded in to an ElementTree Element, the find method is unable to find one of the elements without a namespace assigned to it. ``` import xml.etree.ElementTree as ElementTree xml_text = """ http://schemas.xmlsoap.org/soap/envelope/;>a:ActionNotSupportedThe message with Action \'\' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher. This may be because of either a contract mismatch (mismatched Actions between sender and receiver) or a binding/security mismatch between the sender and the receiver. Check that sender and receiver have the same contract and the same binding (including security requirements, e.g. Message, Transport, None). """ xml = ElementTree.fromstring(xml_text) ele = xml.find('faultstring') ele == None #True ``` -- components: XML messages: 332106 nosy: spacether priority: normal severity: normal status: open title: xml.etree.ElementTree Elment.find bug, fails to find tag type: enhancement versions: Python 3.7 ___ Python tracker <https://bugs.python.org/issue35531> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue33643] Mock functions with autospec STILL don't support assert_called_once, assert_called, assert_not_called
Justin Dray added the comment: I can still reproduce this with python 3.6.5: https://gist.github.com/justin8/c6a565d3b64222a9ba3a2568d1d830ee no .assert_called() on autospec'd functions, but it works with normal mock.MagicMock() ipython autocomplete shows assert_any_call, assert_called_once, assert_called_with and assert_has_calls as valid functions however? -- nosy: +Justin Dray ___ Python tracker <https://bugs.python.org/issue33643> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue27755] Retire DynOptionMenu with a ttk Combobox
Justin Foo added the comment: Thanks for analysing further, Terry. My original goal was a drop-in replacement for an aspect of IDLE I found quite annoying (on Windows). Unfortunately, my limited playing with tkinter didn't inspire me to go beyond this. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue27755> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue29837] python3 pycopg2 import issue on solaris 10
New submission from justin: Hi, I have installed psycopg2 through pip3, but when I tried to import it, I got the following error. what could be the problem? help> psycopg2 problem in psycopg2 - ImportError: ld.so.1: python3.3: fatal: relocation error: file /opt/csw/lib/python3.3/site-packages/psycopg2/_psycopg.so: symbol timeradd: referenced symbol not found thanks justin -- components: Build messages: 289763 nosy: juwang priority: normal severity: normal status: open title: python3 pycopg2 import issue on solaris 10 type: compile error versions: Python 3.3 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue29837> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue29518] 'for' loop not automatically breaking (index error on line of loop header)
Justin McNiel added the comment: While restarting didn't fix it, waiting for the next morning did, so I am afraid that that isn't possible, also, I have made tremendous changes to my code since then, but I would by happy to send you any bit of my code that you would like, it cold also be an issue with my computer, our IT department is very work heavy and doesn't always install the operating system properly (ie. not installing the driver for the touchpad) On Feb 10, 2017 4:53 AM, "Steven D'Aprano" <rep...@bugs.python.org> wrote: > > Steven D'Aprano added the comment: > > I agree with Josh: the exception you are giving doesn't seem possible with > the code snippet shown. Please COPY AND PASTE (not a screen shot) the text > of the entire traceback, starting with the line "Traceback..." > > I suspect that you may have shadowed the built-in range or len object with > some custom object, but I could be completely wrong. But without more > information, we cannot tell what is going on. > > It would be really useful if you could provide a minimal (short as > possible) script that reproduces the problem. And please confirm that you > can reproduce the problem in the regular CPython interpreter, without using > any third-party IDEs. > > -- > nosy: +steven.daprano > > ___ > Python tracker <rep...@bugs.python.org> > <http://bugs.python.org/issue29518> > ___ > -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue29518> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue29518] 'for' loop not automatically breaking (index error on line of loop header)
New submission from Justin McNiel: All for loops are refusing to break (Python 2.7.13) on win32 - only on execution of '.py' file an example would be:" for x in range(5): #Line 1 of main.py print x#Line 2 of main.py " and the resulting error would be:" File "pathToFile\main.py", line 1, in for x in range(5): IndexError: array index out of range " I also have 32-bit python 3.6 installed, but the default for opening '.py' files is python 2.7 This error happens on custom made generators too, but never in the interactive shell. -- components: Windows files: pythonError.png messages: 287473 nosy: Justin McNiel, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: 'for' loop not automatically breaking (index error on line of loop header) type: behavior versions: Python 2.7 Added file: http://bugs.python.org/file46616/pythonError.png ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue29518> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue28639] inspect.isawaitable(native_coro) returns int
New submission from Justin Mayfield: Patch available on my github fork.. https://github.com/mayfield/cpython/commit/8d50cc61f42fa280d380e9c10c420c949a619bef -- components: asyncio messages: 280280 nosy: Justin Mayfield, gvanrossum, yselivanov priority: normal severity: normal status: open title: inspect.isawaitable(native_coro) returns int type: behavior versions: Python 3.5, Python 3.6, Python 3.7 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue28639> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue28506] Multiprocessing Pool starmap - struct.error: 'i' format requires -2e10<=n<=2e10
Justin Ting added the comment: Actually, on further inspection, I seem to be having a slightly different problem with the same error that I initially described now. Even after modifying my code so that each python forked off to another process was only given the following arguments: args = [(None, models_shape, False, None, [start, end], 'data/qp_red_features.npy') for start, end in jobs] where models_shape, start, and end are only single integers, the same error still comes up as a result. Within each process, I'm reading in a (relatively small, only 12MB) .npy ndarray and taking the [start:end] slice. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue28506> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue28506] Multiprocessing Pool starmap - struct.error: 'i' format requires -2e10<=n<=2e10
Justin Ting added the comment: Ah, should have picked that up, coding at 3:30am doesn't do wonders for keeping a clear head. Thanks Tim, I'll keep that in mind! *Justin Ting* *E* justingl...@gmail.com | *M* +61 424 751 665 | *L* *https://au.linkedin.com/in/justinyting <https://au.linkedin.com/in/justinyting>* | *G *https://github.com/jyting On Sun, Oct 23, 2016 at 3:48 AM, Tim Peters <rep...@bugs.python.org> wrote: > > Tim Peters added the comment: > > This has nothing to do with the _values_ you're passing - it has to do > with the length of the pickle string: > > def _send_bytes(self, buf): > n = len(buf) > # For wire compatibility with 3.2 and lower > header = struct.pack("!i", n) IT'S BLOWING UP HERE > if n > 16384: > ... > self._send(header) > self._send(buf) > > where the traceback shows it's called here: > > self._send_bytes(ForkingPickler.dumps(obj)) > > Of course the less data you're passing, the smaller the pickle, and that's > why it doesn't blow up if you pass subsets of the data. > > I'd suggest rethinking how you're sharing data, as pushing two-gigabyte > pickle strings around is bound to be the least efficient way possible even > if it didn't blow up ;-) > > -- > nosy: +tim.peters > > ___ > Python tracker <rep...@bugs.python.org> > <http://bugs.python.org/issue28506> > ___ > -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue28506> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue28506] Multiprocessing Pool starmap - struct.error: 'i' format requires -2e10<=n<=2e10
New submission from Justin Ting: Multiprocessing is throwing this error when dealing with large amounts of data (all floating points an integers), but none of which exceeds the number boundaries in the error that it throws: File "/root/anaconda3/lib/python3.5/multiprocessing/pool.py", line 268, in starmap return self._map_async(func, iterable, starmapstar, chunksize).get() File "/root/anaconda3/lib/python3.5/multiprocessing/pool.py", line 608, in get raise self._value File "/root/anaconda3/lib/python3.5/multiprocessing/pool.py", line 385, in _handle_tasks put(task) File "/root/anaconda3/lib/python3.5/multiprocessing/connection.py", line 206, in send self._send_bytes(ForkingPickler.dumps(obj)) File "/root/anaconda3/lib/python3.5/multiprocessing/connection.py", line 393, in _send_bytes header = struct.pack("!i", n) struct.error: 'i' format requires -2147483648 <= number <= 2147483647 > /root/anaconda3/lib/python3.5/multiprocessing/connection.py(393)_send_bytes() -> header = struct.pack("!i", n) It works fine on any number of subsets of this data, but not when put together. -- components: Library (Lib) messages: 279200 nosy: Justin Ting priority: normal severity: normal status: open title: Multiprocessing Pool starmap - struct.error: 'i' format requires -2e10<=n<=2e10 type: behavior versions: Python 3.5 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue28506> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue27755] Retire DynOptionMenu with a ttk Combobox
Justin Foo added the comment: Is #24781 likely to make it into Python 3.6? Otherwise, would this patch be of any benefit in the meantime? -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue27755> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24837] await process.wait() does not work with a new_event_loop
Justin Mayfield added the comment: I agree with Guido. I spent a couple hours trying to debug some of my own code that turned out to be this issue. My use case is single threaded too. Perhaps I'm daft but I don't understand why the child watcher is part of the event loop policy. At first glance it appears that it would be better suited being attached to any event loop in the main thread and then this wouldn't be an issue. I wonder if this design is intended to support launching subprocesses from non-main thread event loops, which seems inherently dangerous and potentially misguided to me. -- nosy: +Justin Mayfield ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue24837> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue27755] Retire DynOptionMenu with a ttk Combobox
Justin Foo added the comment: I wasn't sure if the ongoing work in #24781 essentially rendered my patch obsolete, so I keenly await Mark's response. Upon reflection, I think my patch is a cheap win even if it's later overhauled by other improvements. -- status: closed -> open ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue27755> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue27755] Retire DynOptionMenu with a ttk Combobox
Justin Foo added the comment: Ah, I've noticed the folly of my ways. This sort of stuff is already being managed with patches filed under various other issues. It just wasn't obvious to me as I wasn't seeing many new improvements in the default branch or much communication on IDLE-dev. -- resolution: -> duplicate status: open -> closed ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue27755> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22395] test_pathlib error for complex symlinks on Windows
Justin Foo added the comment: This is no longer a problem for me and I can't reproduce why it was even a problem in the first place. -- status: open -> closed ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue22395> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21417] Compression level for zipfile
Justin Foo added the comment: I thought about that, but: 1. compresslevel=None might make look like no compression was being done at all 2. The current default is not 9 for all backends -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue21417> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21417] Compression level for zipfile
Justin Foo added the comment: Would compresslevel be a suitable argument? All the backend compressors accept values from 1 to 9 if I'm not mistaken. -- nosy: +jfoo ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue21417> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue27755] Retire DynOptionMenu with a ttk Combobox
Changes by Justin Foo <jcjf1...@gmail.com>: -- keywords: +patch Added file: http://bugs.python.org/file44097/issue27755.patch ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue27755> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue27755] Retire DynOptionMenu with a ttk Combobox
New submission from Justin Foo: One aspect of the IDLE interface that looks extremely old is the the dropdown menu. In the patch, I think I've preserved whatever essential functionality DynOptionMenu used to have, but I'm relatively unfamiliar with Tk so I'm not sure. -- assignee: terry.reedy components: IDLE messages: 272609 nosy: jfoo, terry.reedy priority: normal severity: normal status: open title: Retire DynOptionMenu with a ttk Combobox type: enhancement versions: Python 3.6 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue27755> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue25593] _sock_connect_cb can be called twice resulting in InvalidStateError
Justin Mayfield added the comment: Alexander, That sounds unrelated. I'd treat it as a new issue until you have concrete evidence to the contrary. Also on face value it sounds like it might just be your operating systems open file limit. On OSX I think the default open file limit is in the hundreds (256 on my box). Generally on unix-oid platforms it can be checked and changed with the `ulimit -n` command. Cheers -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue25593> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6766] Cannot modify dictionaries inside dictionaries using Managers from multiprocessing
Justin Patrin added the comment: I'm still running into these issues with Python 2.7.10. I'm trying to find a way to share dynamically allocated sub-dictionaries through multiprocessing as well as dynamically allocated RLock and Value instances. I can use the manager to create them but when I put them in a managed dict the various issues related in this ticket happen. -- nosy: +Justin Patrin ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue6766> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue25593] _sock_connect_cb can be called twice resulting in InvalidStateError
Justin Mayfield added the comment: I should have commented more on the run_once removal. The depiction given in its docstring seemed inconsistent with the new way stop works and I found no callers, so it seemed like it was best left out to avoid confusion. No worries though, I didn't get to know that test module very well before messing with it. It just came up in my scan for stop() callers. Looks good, I've applied to a 3.5.0 build and will include it in my testing from now on. Thanks Guido. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue25593> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue25593] _sock_connect_cb can be called twice resulting in InvalidStateError
Justin Mayfield added the comment: Ha, email race. Regarding rev 2, the updated docstring and scheduled stop looks good along with alleviating the confusion I mentioned. I'm not sure about your warning comment; Perhaps that's a patch I didn't lay eyes on. Cheers. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue25593> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue25593] _sock_connect_cb can be called twice resulting in InvalidStateError
Justin Mayfield added the comment: I see. Seems like good discussion over there. I joined up. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue25593> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue25593] _sock_connect_cb can be called twice resulting in InvalidStateError
Justin Mayfield added the comment: Attached patch submission for stop flag proposal. I assume you didn't mean a github PR since the dev docs seem to indicate that is for readonly usage. This passes all the tests on my osx box but it should obviously be run by a lot more folks. -- Added file: http://bugs.python.org/file41059/Issue25593_fix.patch ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue25593> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue25593] _sock_connect_cb can be called twice resulting in InvalidStateError
Justin Mayfield added the comment: You bet. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue25593> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue25593] _sock_connect_cb can be called twice resulting in InvalidStateError
Justin Mayfield added the comment: +1 Let me know what I can do to help. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue25593> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue25593] _sock_connect_cb can be called twice resulting in InvalidStateError
Justin Mayfield added the comment: Interesting. I was going to do an analysis what using _ready.appendleft() for adding selector events would do for that scenario. The idea being to consistently juxtapose exiting callbacks, selector events and new callbacks. However I think this just moves the pawn in this ioloop halting problem. Is it worth investigating a change to the stop mechanism instead? Instead of raising an exception in the middle of run_once, it could set a flag to be seen by run_forever(). This may avoid this class of problem altogether and ensure run_once is a fairly simple and predictable. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue25593> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue25593] _sock_connect_cb can be called twice resulting in InvalidStateError
Justin Mayfield added the comment: Yes, that's what I was suggesting. Looking at tornado they do the stop between callbacks/matured-scheduled and events. That approach seems somewhat arbitrary to me at first glance but tornado is very mature and they usually have good reasons for what they do. The notion of always completing a cycle seems more apt to me; Ie. your first design. A compelling thought experiment for allowing stop() to be lazy is if a user could somehow know when stop() was going to run or when it had been run. The nature of ioloop programming prevents you from knowing when it will run and because stop() has no return handle/future/task a user can't actually know when it did run. Ie. there is no way to await/add_done_callback on it, so baring hacks that bookend a stop() with marker callbacks it should be, as you said, sufficiently vague to justify a (more) lazy effect. -- I more or less agree on the s/cancelled/done/ changes. I'm using a similar monkey patch in my libraries to dance around this issue right now. I still don't exactly like the idea that code is written with an explicit expectation that it could be pending or cancelled, but then must also be inherently prepared for spurious done callbacks. This seems like a borderline contract violation by add_writer() and co. I suppose that add_writer() is primarily targeted at streams and the case of an EINTR in a socket connect() is a more a one-shot. Tough call. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue25593> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue25593] _sock_connect_cb can be called twice resulting in InvalidStateError
Justin Mayfield added the comment: I don't believe this is a case of nonidempotent callbacks, unless you are referring to Future.set_result(), which by design can't be called twice. The callbacks are given an inconsistent opportunity to modify the poll set because of indeterminacy in the ioloop. That being said I understand your reluctance given the amount of turmoil this has but would argue that consistency with tornado is a powerful ally and that a model where any callback using call_soon will be guaranteed the opportunity to modify the poll set is a good thing. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue25593> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue25593] _sock_connect_cb can be called twice resulting in InvalidStateError
Justin Mayfield added the comment: Guido, Shouldn't this not be the case for level triggered polling? From looking at selectors it looks like these are always level triggered which means they should only event once. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue25593> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue25593] _sock_connect_cb can be called twice resulting in InvalidStateError
Justin Mayfield added the comment: Attached server side of repro. -- Added file: http://bugs.python.org/file41017/Issue25593_repro_server.py ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue25593> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue25593] _sock_connect_cb can be called twice resulting in InvalidStateError
Justin Mayfield added the comment: Just reproduced on Linux, Fedora Core 23. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue25593> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue25593] _sock_connect_cb can be called twice resulting in InvalidStateError
Justin Mayfield added the comment: Attaching simplified test setup. It does take some doing to repro so the local async server is required to make it happen (for me). When I tried just pointing to python.org it would not repro in 100 iterations, but using a local dummy server repros 100% for me. -- Added file: http://bugs.python.org/file41016/Issue25593_repro_client.py ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue25593> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue25593] _sock_connect_cb can be called twice resulting in InvalidStateError
Justin Mayfield added the comment: Nevermind, in the case of writeablity it won't matter either way. -- So in looking at tornado's ioloop they run the ready callbacks before calling poll(). So the callbacks can modify the poll set. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue25593> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue25593] _sock_connect_cb can be called twice resulting in InvalidStateError
Justin Mayfield added the comment: This code repros without aiohttp when pitted against the previously attached web server (again on OSX 10.11, mid-2012 MBPr). Admittedly this may seem very arbitrary but I have better reasons in my production code for stopping an IOLoop and starting it again (which seems to be important to the reproduction steps). import asyncio loop = asyncio.get_event_loop() def batch_open(): for i in range(100): c = asyncio.ensure_future(asyncio.open_connection('127.0.0.1', 8080)) c.add_done_callback(on_resp) def on_resp(task): task.result() loop.stop() loop.call_soon(batch_open) while True: loop.run_forever() -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue25593> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue25593] _sock_connect_cb can be called twice resulting in InvalidStateError
Justin Mayfield added the comment: I'm attaching a patch that runs `_ready` callbacks at the start of `_run_once`. The style and implications are ranging so I leave it to you at this point. -- keywords: +patch Added file: http://bugs.python.org/file41019/run_once_testfix_for_Issue25593.patch ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue25593> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue25593] _sock_connect_cb can be called twice resulting in InvalidStateError
Justin Mayfield added the comment: I believe I'm seeing this bug in a non-threaded and non-forked env. System: OSX 10.11.1 (15B42) Python 3.5.0 (from brew install) I'm using aiohttp to create several dozens of HTTP connections to the same server (an async tornado web server). Nothing special is being done around the event loop creation (standard get_event_loop()). However in my system the event loop is frequently stopped, via ioloop.stop(), and restarted via ioloop.run_forever(). I'm not sure this is related to the issue yet, but it's worth mentioning. I can't provide simplified test code just yet, but I can reproduce in my env with nearly 100% odds when doing a full system test. Attached is a sample backtrace. -- nosy: +Justin Mayfield Added file: http://bugs.python.org/file41015/asyncio_invalid_state_bt.txt ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue25593> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24652] C-API Pure Embedding enhancement
New submission from Justin Huang: From the example in here: https://docs.python.org/2/extending/embedding.html#pure-embedding when directly using the example (compiling and trying with external file etc.) it doesn't work right away. Instead an extra line: PySys_SetArgv(argc, argv); must be added to get it to work. -- messages: 246847 nosy: Justin Huang priority: normal severity: normal status: open title: C-API Pure Embedding enhancement type: enhancement versions: Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24652 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24645] logging.handlers.QueueHandler should not lock when handling a record
Justin Bronder added the comment: On 16/07/15 20:03 +, R. David Murray wrote: R. David Murray added the comment: Can you expand on the deadlock? Are you saying that the extra locking is causing the deadlock? -- nosy: +r.david.murray, vinay.sajip versions: -Python 3.2, Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24645 ___ Sure, here is the simplest example of the deadlock I could come up with. Using __repr__() in the way presented is pretty stupid in this case but it does make sense if you have objects which are backed by a database where communication is handled in a separate thread. What happens is this: 1. The main thread calls into the logger, handle() grabs the I/O lock. 2. String expansion of the Blah instance begins, this makes a request to the second thread. 3. The second thread wants to log prior to responding, it gets stuck waiting for the I/O lock in handle() import logging import logging.handlers import queue import types import threading fmt = logging.Formatter('LOG: %(message)s') stream = logging.StreamHandler() stream.setFormatter(fmt) log_queue = queue.Queue(-1) queue_handler = logging.handlers.QueueHandler(log_queue) queue_listener = logging.handlers.QueueListener(log_queue, stream) queue_listener.start() def handle(self, record): rv = self.filter(record) if rv: self.emit(record) return rv # Uncomment to remove deadlock #queue_handler.handle = types.MethodType(handle, queue_handler) logger = logging.getLogger() logger.addHandler(queue_handler) logger.setLevel(logging.DEBUG) class Blah(object): def __init__(self): self._in = queue.Queue() self._out = queue.Queue() def pub(): self._in.get(block=True) logging.info('Got a request') self._out.put('hi') self._pub_thread = threading.Thread(target=pub) self._pub_thread.start() def __repr__(self): self._in.put('gimme data') return self._out.get() def __del__(self): self._pub_thread.join() b = Blah() logger.info('About to log') logger.info('blah = %s', b) queue_listener.stop() -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24645 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24645] logging.handlers.QueueHandler should not lock when handling a record
New submission from Justin Bronder: The Queue backing the QueueHandler is already sufficiently locking for thread-safety. This isn't a huge issue, but the QueueHandler is a very nice built-in which could be used to work around a deadlock I've encountered several times. In brief, functions which can cause other threads to log being called from either __repr__() or __str__(). -- components: Library (Lib) files: queue-handler-no-lock.patch keywords: patch messages: 246812 nosy: jsbronder priority: normal severity: normal status: open title: logging.handlers.QueueHandler should not lock when handling a record versions: Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 3.6 Added file: http://bugs.python.org/file39935/queue-handler-no-lock.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24645 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24645] logging.handlers.QueueHandler should not lock when handling a record
Justin Bronder added the comment: On 16/07/15 23:21 +, Vinay Sajip wrote: Vinay Sajip added the comment: I'm not sure I want to make a special case just to support what seems like a somewhat pathological use case (no offence intended). If you need this, there's no reason you couldn't subclass QueueHandler and override handle(), is there? Hey, no offense taken, it wasn't even my code that tripped on this, I just got the pleasure of debugging it! Anyways, it's up to you all if you want to include this, as you mentioned, it's easy enough to work around and I've already done so. However, the reason I submitted the patch is because I believe using the I/O lock is redundant as the Queue is handling the necessary synchronization already. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24645 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23429] -5**4 returns -625 instead of 625
Justin added the comment: I think there is a misunderstanding of precedence here. If we had an operation were -1 * 5**4, I could fully understand the statement of precedence. However, in the absence of the -1 *, the -5 becomes a single atom. For example: myVal = -5 myVal**4 625 # not -625 because it is treated as a single atom. The statement -5**4 - 20, should yield the same result and yet, it does not. -5**4 - 20 -645 5**4 - 20 605 Let's take the reverse side of this take 4**-2, if precedence is to hold the same way, why would this not be 16 instead of the correct answer of 0.0625. In this instance, the unary sign all of a sudden jumped in precedence and became a single atom. 4**-2 0.0625 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23429 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23429] -5**4 returns -625 instead of 625
Justin added the comment: Thank you for the link. I can understand the language definition and I can accept it at face value. The confusion I have is that it does not appear to be consistent. My example of -5**4 vs 4**-2 would both have literals with a unary sign. One works as expected, whereas the other one does not. Granted that I am new to Python, although well experience in development and programming; I will conceded to those more experienced in Python development that it is as it should be. Regards, -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23429 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23429] -5**4 returns -625 instead of 625
New submission from Justin: C:\Users\Justinpython Python 3.4.2 (v3.4.2:ab2c023a9432, Oct 6 2014, 22:15:05) [MSC v.1600 32 bit (Intel)] on win32 Type help, copyright, credits or license for more information. print(-5**4) -625 #note...this should be 625 and not a negative 625 -- messages: 235642 nosy: gilbe024 priority: normal severity: normal status: open title: -5**4 returns -625 instead of 625 type: behavior versions: Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23429 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23317] Incorrect description of descriptor invocation in Python Language Reference
Justin Eldridge added the comment: Ah, I see how writing a description of this which is both concise and precise would be difficult, especially for Python 2. But the Class Binding description is correct, since if the __get__ method is *not* defined on the type (of the descriptor), the descriptor instance itself is returned (so explicitly calling type in the equivalent expression would be wrong) I see, but couldn't this also be held against the current equivalent? That is, saying A.x is equivalent to A.__dict__['x'].__get__(None, A) is not stricly true when __get__ isn't defined on type(x). I think I see now why this is difficult to document cleanly, and the Special method lookup section of the documentation does a good job of explaining this. The issue isn't exclusive to descriptors. It affects, for example, the documentation on rich comparison operators, which says that x == y invokes x.__eq__(y), when this hasn't quite been true since old-style classes. So saying x == y is equivalent to x.__eq__(y) isn't really correct, and saying that it is equivalent to type(x).__eq__(x,y) isn't quite right either, as implicit invocation may bypass the metaclass's __getattribute__. The latter, however, seems less wrong. Is there a reason that the former is preferred by the documentation? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23317 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23317] Incorrect description of descriptor invocation in Python Language Reference
New submission from Justin Eldridge: The section titled Invoking Descriptors in the Python Language Reference [1] says: Class Binding If binding to a new-style class, A.x is transformed into the call: A.__dict__['x'].__get__(None, A). This suggests that __get__ is looked up on the instance of x, when I believe that it is actually looked up on the type. That is, it's my understanding that A.x invokes: type(A.__dict__['x']).__get__(A.__dict__['x'], None, Foo)) Here's some Python 3.4 code demonstrating this: class A: pass class Descriptor: def __get__(self, obj, cls): print(Getting!) A.x = Descriptor() def replacement_get(obj, cls): print(This is a replacement.) A.__dict__['x'].__get__ = replacement_get Now, writing: A.x Getting! A.__dict__['x'].__get__(None, A) This is a replacement! type(A.__dict__['x']).__get__(A.__dict__['x'], None, A) Getting! The documentation makes a similar statement about instance binding that also appears to be incorrect. This is the case in all versions of the document I could find. What I believe to be the actual behavior is implied by a later section in the same document, which states that the implicit invocation of special methods is only guaranteed to work correctly if the special method is defined on the type, not the instance. This suggests that the statements in Invoking Descriptors aren't quite correct, and while the true behavior is a little more verbose, I think it would be worthwhile to update the documentation so as to avoid confusion. [1]: https://docs.python.org/2/reference/datamodel.html#invoking-descriptors -- assignee: docs@python components: Documentation messages: 234676 nosy: Justin.Eldridge, docs@python priority: normal severity: normal status: open title: Incorrect description of descriptor invocation in Python Language Reference type: enhancement versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 3.6 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23317 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22395] test_pathlib error for complex symlinks on Windows
Justin Foo added the comment: The failing tests were: * test_complex_symlinks_absolute * test_complex_symlinks_relative * test_complex_symlinks_relative_dot_dot for both PathTest and WindowsPathTest, via inheritance from the _BasePathTest class. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22395 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22395] test_pathlib error for complex symlinks on Windows
New submission from Justin Foo: The _check_complex_symlinks function compares paths for string equality instead of using the assertSame helper function. Patch attached. -- components: Tests messages: 226828 nosy: jfoo priority: normal severity: normal status: open title: test_pathlib error for complex symlinks on Windows type: enhancement versions: Python 3.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22395 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22395] test_pathlib error for complex symlinks on Windows
Justin Foo added the comment: The _check_complex_symlinks function compares stringified paths for string equality instead of using the assertSame helper method. Patch attached. -- keywords: +patch Added file: http://bugs.python.org/file36609/issue22395.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22395 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21699] Windows Python 3.4.1 pyvenv doesn't work in directories with spaces.
New submission from Justin Engel: Venv virtual environments don't work with spaces in the path. (env) C:\My Directory\path pip -V Fatal error in launcher: Unable to create process using 'C:\My Directory\path\env\Scripts\python.exe C:\My Directory\path\env\Scripts\pip.exe -V' -- components: Windows messages: 220098 nosy: Justin.Engel priority: normal severity: normal status: open title: Windows Python 3.4.1 pyvenv doesn't work in directories with spaces. type: crash versions: Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21699 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20849] add exist_ok to shutil.copytree
Changes by Justin Myers jus...@justinmyers.net: -- nosy: +justin.myers ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20849 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13936] RFE: change bool(datetime.time(0, 0, 0)) to evaluate as True
Justin Brown added the comment: This behavior conflicts with the other major classes, datetime.date and datetime.datetime. The ostensible reason for this falsy behavior is that midnight represents a fundamental zero point. We should expect to see similar zero points that evaluate to False for the other two classes. However, they do not include such falsy behavior. In [2]: bool(datetime.datetime(datetime.MINYEAR, 1, 1)) Out[2]: True In [3]: bool(datetime.date(datetime.MINYEAR, 1, 1)) Out[3]: True Why don't these classes have any sense of zero at their minimums? datetime.time.__bool__ should be dropped if for nothing more than consistency. -- nosy: +fandingo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13936 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7511] msvc9compiler.py: ValueError when trying to compile with VC Express
Justin Foo added the comment: I think getting this bug fixed would be really nice from a user experience point of view. I've further into this for my own setup, which is Python 3.3 64-bit, Visual C++ Express 2010 and the Windows SDK v7.1 (plus service packs), which is probably a typical setup for a user looking to build Python extensions without paying for a compiler. Here's what I've noticed, apart from the fact that msvccompiler9.py is a mess. query_vcvarsall executes vcvarsall.bat amd64 set. The first part, trying to delegate to another batch file that doesn't exist, will fail. So no environment variables will be set, but the PATH environment variable always exists, hence ValueError: ['path']. The DISTUTILS_USE_SDK environment variable is useless, even leaving aside the fact that MsSdk also needs to be defined. The idea is that distutils will trust that the user has set the appropriate environment variables (e.g. SetEnv.Cmd /Release). However, successful compilation of 64-bit extensions won't rely on this variable at all: 1. DISTUTILS_USE_SDK/MsSdk defined, SetEnv not called: cl.exe and friends can't be resolved and nothing works. 2. DISTUTILS_USE_SDK/MsSdk defined, SetEnv called: cl.exe and friends can be resolved and everything works. 3. DISTUTILS_USE_SDK/MsSdk undefined, SetEnv not called: vcvarsall.bat amd64 will fail and we end up with ValueError: ['path'] as above. 4. DISTUTILS_USE_SDK/MsSdk undefined, SetEnv called: in query_vcvarsall, vcvarsall.bat amd64 still fails, but it doesn't matter at this point, because the environment variables INCLUDE, LIB, LIBPATH and PATH will exist, so parsing vcvarsall.bat amd64 set works. This doesn't guarantee linking with the correct bitness, but one would hope so :) I believe SetEnv.Cmd can be found using HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.1\WinSDKTools or HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v7.1\WinSDKTools. -- versions: +Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7511 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20690] IDLE Indents convert to spaces and then throws error
New submission from Justin Barker: When I add some lines to my module code, some of the tabs that I enter convert to spaces. This throws an inconsistency error and I can't get it to stop! -- components: IDLE files: test.py messages: 211664 nosy: Justin.Barker priority: normal severity: normal status: open title: IDLE Indents convert to spaces and then throws error type: behavior versions: Python 3.3 Added file: http://bugs.python.org/file34148/test.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20690 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20301] Correct docs for default access argument for DeleteKeyEx
New submission from Justin Foo: The default access for winreg.DeleteKeyEx is winreg.KEY_WOW64_64KEY (as per the function signature). This the documentation for Python 2.7 has this correct. Reference: http://hg.python.org/cpython/file/2e32462e4832/PC/winreg.c#l1089 -- assignee: docs@python components: Documentation files: winreg.DeleteKeyEx.docs.patch keywords: patch messages: 208462 nosy: docs@python, jfoo priority: normal severity: normal status: open title: Correct docs for default access argument for DeleteKeyEx versions: Python 3.3, Python 3.4 Added file: http://bugs.python.org/file33544/winreg.DeleteKeyEx.docs.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20301 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com