[issue46776] RecursionError when using property() inside classes
New submission from chen-y0y0 : A simple class definition: class Foo: bar = property(lambda self: self.bar) And get the value of Foo.bar, it returns correctly, . And get the value of Foo().bar, it raises RecursionError: Traceback (most recent call last): File "", line 1, in File "", line 1, in File "", line 1, in File "", line 1, in [Previous line repeated 996 more times] RecursionError: maximum recursion depth exceeded -- components: Interpreter Core messages: 413403 nosy: prasechen priority: normal severity: normal status: open title: RecursionError when using property() inside classes type: behavior versions: Python 3.10, Python 3.11, Python 3.7, Python 3.8, Python 3.9 ___ Python tracker <https://bugs.python.org/issue46776> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46662] Lib/sqlite3/dbapi2.py: convert_timestamp function failed to correctly parse timestamp
Change by Bo-wei Chen : -- keywords: +patch pull_requests: +29342 stage: -> patch review pull_request: https://github.com/python/cpython/pull/31169 ___ Python tracker <https://bugs.python.org/issue46662> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46662] Lib/sqlite3/dbapi2.py: convert_timestamp function failed to correctly parse timestamp
New submission from Bo-wei Chen : convert_timestamp function in Lib/sqlite3/dbapi2.py fails to parse a timestamp correctly, if it does not have microseconds but comes with timezone information, e.g. b"2022-02-01 16:09:35+00:00" Traceback: Traceback (most recent call last): File "/Users/user/Desktop/test.py", line 121, in convert_timestamp(b"2022-02-01 16:09:35+00:00") File "/Users/user/Desktop/test.py", line 112, in convert_timestamp hours, minutes, seconds = map(int, timepart_full[0].split(b":")) ValueError: invalid literal for int() with base 10: b'35+00' -- components: Library (Lib) messages: 412655 nosy: Rayologist priority: normal severity: normal status: open title: Lib/sqlite3/dbapi2.py: convert_timestamp function failed to correctly parse timestamp type: behavior versions: Python 3.9 ___ Python tracker <https://bugs.python.org/issue46662> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46636] Bugs of 2to3 on built-in function or types(classes)
Change by chen-y0y0 : -- title: Bugs of 2to3 -> Bugs of 2to3 on built-in function or types(classes) ___ Python tracker <https://bugs.python.org/issue46636> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46636] Bugs of 2to3
New submission from chen-y0y0 : I have a file named foo.py: try : input = raw_input int = long chr = unichr range = xrange except NameError : pass When I process this file to 2to3, it shows: --- foo.py (original) +++ foo.py (refactored) @@ -1,7 +1,7 @@ try : input = raw_input -int = long -chr = unichr +int = int +chr = chr range = xrange except NameError : pass RefactoringTool: Files that need to be modified: RefactoringTool: foo.py I don't know why it modifies the Python 2.x and 3.x compatible code. -- components: 2to3 (2.x to 3.x conversion tool) messages: 412508 nosy: prasechen priority: normal severity: normal status: open title: Bugs of 2to3 type: behavior versions: Python 3.10, Python 3.11, Python 3.7, Python 3.8, Python 3.9 ___ Python tracker <https://bugs.python.org/issue46636> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46112] PEP 8 code format
New submission from Zhiyuan Chen : Current cpython code base still contains a massive amount of code that is not complied with the PEP-8 formatting. For example, there are 553 one line if statement (`if xxx: yyy`) in the current codebase. -- files: onelineif.txt messages: 408761 nosy: ZhiyuanChen priority: normal severity: normal status: open title: PEP 8 code format type: enhancement Added file: https://bugs.python.org/file50499/onelineif.txt ___ Python tracker <https://bugs.python.org/issue46112> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue45980] Why there isn't a “Python 2.2” for PyPI's classifiers?
chen-y0y0 added the comment: And NOT ONLY Python 2.2, there aren't also Python 2.1 or earlier version. -- ___ Python tracker <https://bugs.python.org/issue45980> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue45980] Why there isn't a “Python 2.2” for PyPI's classifiers?
New submission from chen-y0y0 : The output: Upload failed (400): Invalid value for classifiers. Error: Classifier ' Programming Language :: Python :: 2.2' is not a valid classifier. error: Upload failed (400): Invalid value for classifiers. Error: Classifier ' Programming Language :: Python :: 2.2' is not a valid classifier. So, why is there no Python 2.2? Is it because it is outdated or because it is discriminated against? -- components: Distutils messages: 407663 nosy: dstufft, eric.araujo, prasechen priority: normal severity: normal status: open title: Why there isn't a “Python 2.2” for PyPI's classifiers? type: performance versions: Python 3.10, Python 3.11, Python 3.6, Python 3.7, Python 3.8, Python 3.9 ___ Python tracker <https://bugs.python.org/issue45980> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue45112] Python exception object is different after pickle.dumps and pickle.loads
Change by Chen Zero : -- title: Python exception object is different after pickle.loads and pickle.dumps -> Python exception object is different after pickle.dumps and pickle.loads ___ Python tracker <https://bugs.python.org/issue45112> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue45112] Python exception object is different after pickle.loads and pickle.dumps
New submission from Chen Zero : Hi, when I'm trying to serialize/deserialize python exception object through pickle, I found that deserialize result is not the same as the original object... My python version is 3.9.1, working os: macOS Big Sur 11.4 Here is minimum reproducing code example: import pickle class ExcA(Exception): def __init__(self, want): msg = "missing " msg += want super().__init__(msg) ExcA('bb') # this will output ExcA("missing bb"), which is good pickle.loads(pickle.dumps(ExcA('bb'))) # this will output ExcA("missing missing bb"), which is different from `ExcA('bb')` -- files: screenshot.png messages: 401128 nosy: yonghengzero priority: normal severity: normal status: open title: Python exception object is different after pickle.loads and pickle.dumps type: behavior versions: Python 3.9 Added file: https://bugs.python.org/file50262/screenshot.png ___ Python tracker <https://bugs.python.org/issue45112> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue44879] How to insert newline characters as normal characters while input()?
New submission from chen-y0y0 : # Ɪ know, if Ɪ press enter key while input(), the method will be completed and return a str value. # Ɪ am trying to insert newline characters as normal characters while input() method. # The “normal characters” means: # 1. It can be deleted by backspace(“\x7b”) or EOF or delete key. # 2. It can be interprered as a normal byte. # Ɪ tried by the readline module, it did work. But it may crash, like: # Traceback (most recent call last): # File "", line 1, in # SyntaxError: multiple statements found while compiling a single statement -- components: Argument Clinic, FreeBSD, IO, Interpreter Core, Windows messages: 399327 nosy: koobs, larry, paul.moore, prasechen, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: How to insert newline characters as normal characters while input()? type: crash versions: Python 3.10, Python 3.11, Python 3.6, Python 3.7, Python 3.8, Python 3.9 ___ Python tracker <https://bugs.python.org/issue44879> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue44835] What does "Python for Windows will still be Python for DOS" mean?
Change by chen-y0y0 : -- components: Installation, Windows nosy: paul.moore, prasechen, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: What does "Python for Windows will still be Python for DOS" mean? type: performance versions: Python 3.10, Python 3.11, Python 3.6, Python 3.7, Python 3.8, Python 3.9 ___ Python tracker <https://bugs.python.org/issue44835> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue44696] Python 2.0.1 Installation:
New submission from chen-y0y0 : # I tried to install Python 2.0.1 onto my virtual machine(Windows 3.1) for low-version developing, but an error occurred while the installation: # Error # Could not load the DLL library # C:\TEMP\~GLF256B.TMP. -- components: IO, Installation, Library (Lib), Windows messages: 397941 nosy: paul.moore, prasechen, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: Python 2.0.1 Installation: type: crash ___ Python tracker <https://bugs.python.org/issue44696> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue41515] typing.get_type_hints generates KeyError
Change by Will Chen : -- nosy: +WCA nosy_count: 6.0 -> 7.0 pull_requests: +25458 pull_request: https://github.com/python/cpython/pull/26862 ___ Python tracker <https://bugs.python.org/issue41515> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue44468] Shouldn't `typing.get_type_hints()` default `globalns` to `{}` instead of skipping base classes?
Will Chen added the comment: I opened a PR with a fix and a couple comments on its method: https://github.com/python/cpython/pull/26862 I also *think* I signed the CLA correctly. Not sure. I used my login name here, rather than my Github login, but my account is linked. Didn't add any blurb/changelog notes. Would that be needed? Thanks for looking at this issue quickly! Let me know if there's anything else I can or should do. -- ___ Python tracker <https://bugs.python.org/issue44468> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue44468] Shouldn't `typing.get_type_hints()` default `globalns` to `{}` instead of skipping base classes?
Change by Will Chen : -- keywords: +patch pull_requests: +25437 stage: -> patch review pull_request: https://github.com/python/cpython/pull/26862 ___ Python tracker <https://bugs.python.org/issue44468> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue44468] Shouldn't `typing.get_type_hints()` default `globalns` to `{}` instead of skipping base classes?
New submission from Will Chen : An issue was recently closed that caused synthetic classes and base classes with invalid `__module__` attributes to raise `KeyError()` in `typing.get_type_hints()`: https://bugs.python.org/issue41515 However, the implemented solution appears to be to skip those classes completely with a `continue` statement, instead of getting the annotations that may still be present by using an empty globals dictonary: https://github.com/python/cpython/pull/25352/files#diff-ddb987fca5f5df0c9a2f5521ed687919d70bb3d64eaeb8021f98833a2a716887 In order to work around this issue in my local install of Blender, I had to change `.get_type_hints()` to use an empty dictionary for `globalns` when encountering invalid modules, rather than skipping them: https://developer.blender.org/T88986#1179812 >From reading the commit where the broken behaviour was first introduced— Which >was described/designed as "backwards compatible"— It looks like the original >behaviour was also to use an empty dictionary, and never skip: https://github.com/python/cpython/commit/f350a268a7071ce7d7a5bb86a9b1229782d4963b#diff-ddb987fca5f5df0c9a2f5521ed687919d70bb3d64eaeb8021f98833a2a716887R1501 Using an empty dictionary also seemed to be mentioned in the bug report linked above. IMO using an empty dictionary and still returning annotations from classes with invalid modules seems like it'd be more sensible, predictable, and backwards-compatible, while skipping base classes is likely to just replace the obvious `KeyError()` with less reproducible and nastier errors caused by returning incomplete type hints. -- messages: 396205 nosy: willchencontact priority: normal severity: normal status: open title: Shouldn't `typing.get_type_hints()` default `globalns` to `{}` instead of skipping base classes? type: behavior versions: Python 3.10, Python 3.11 ___ Python tracker <https://bugs.python.org/issue44468> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue44155] Race condition when using multiprocessing BaseManager and Pool in Python3
David Chen added the comment: After some investigation, i almost finally identified the root cause - it was caused by the following line in `Server` class in `manager.py` file: ``` self.listener = Listener(address=address, backlog=16) ``` i'm not sure where the magic number `16` came from, but it turned out it was not big enough for some powerful CPU(48 cores in my case), where the socket server starts refusing to accepting new connections if there are more than `16` unaccepted connections, i think this is why the code stuck at `Client -> answer_challenge` where attempting to create new connection to the server. After i change the number to `32`, this issue is gone. IMO, a magic number here is not very suitable, maybe we could make this number configurable or use `cpu_count` to set it to a better number based on the CPU count. -- ___ Python tracker <https://bugs.python.org/issue44155> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue44155] Race condition when using multiprocessing BaseManager and Pool in Python3
New submission from David Chen : could someone help me out? i spent a lot of time to debug a race condition i have encountered when using BaseManager, Pool within multiprocessing library. here is the simplified code: ``` import sys, time from multiprocessing.managers import BaseManager, SyncManager, BaseProxy from multiprocessing import Process, cpu_count, Pool, Lock, get_context from multiprocessing.queues import Queue, JoinableQueue import queue class QueueManager(BaseManager): pass class Singleton: ''' Decorator class for singleton pattern. ''' def __init__(self, cls): self._cls = cls self._lock = Lock() self._instance = {} def __call__(self, *args, **kwargs): if self._cls not in self._instance: with self._lock: self._instance[self._cls] = self._cls(*args, **kwargs) return self._instance[self._cls] def getInstance(self): return self._instance[self._cls] class LoggingServer(object): def __init__(self, address, pwd): self.logServerAddr = address self.logServerPwd = pwd self.msgQueue = queue.Queue() try: QueueManager.register('getQueue', callable=lambda: self.msgQueue) self.queueManager = QueueManager(address = self.logServerAddr, authkey = self.logServerPwd) self.logServer = self.queueManager.get_server() self.logServer.serve_forever() except: raise RuntimeError("Couldn't start the logging server!") class LoggingProcess(object): def __init__(self, address, pwd): self.logServerAddr = address self.logServerPwd = pwd try: QueueManager.register('getQueue') self.queueManager = QueueManager(address = self.logServerAddr, authkey = self.logServerPwd) self.queueManager.connect() except: raise RuntimeError("Couldn't connect logging process to the logging server!") self.msgQueue = self.queueManager.getQueue() self.process = Process(target=self.loggingProcess, name = "Logging Process", args=(), daemon = True) self.process.start() def terminate(self): self.msgQueue.join() self.process.terminate() def loggingProcess(self): while True: logObj = self.msgQueue.get() print(logObj) @Singleton class Logger(object): def __init__(self, address, pwd): self.logServerAddr = address self.logServerPwd = pwd self.queueManager = None self.msgQueue = None def connectToLogServer(self): try: QueueManager.register('getQueue') self.queueManager = QueueManager(address = self.logServerAddr, authkey = self.logServerPwd) self.queueManager.connect() self.msgQueue = self.queueManager.getQueue() self.ready = True except: raise RuntimeError("Couldn't connect logger to Log Server!") def ReadyCheck(func): def makeDecorator(self, *args, **kwargs): if not self.msgQueue: self.connectToLogServer() func(self, *args, **kwargs) return makeDecorator # Overrided function to log info @ReadyCheck def info(self, info, logfile = sys.stdout): self.msgQueue.put(info) address = ('', 5) password = b'PASSWORD' log = Logger(address, password) def callback(*args): #print("Finished!!!") pass def job(index): time.sleep(0.1) log.info(str(log.msgQueue) + ":{}".format(index)) log.info("here {}".format(index)) if __name__ == "__main__": # import multiprocessing # logger = multiprocessing.log_to_stderr() # logger.setLevel(multiprocessing.SUBDEBUG) serverProcess = Process(target = LoggingServer, name = "LoggingServerDaemon", args = ((address, password)), daemon = True) serverProcess.start() time.sleep(1) loggingProcess = LoggingProcess(address, password) log.info("Starting...") #pool = Pool(cpu_count()) pool = Pool() #Using a small number of worker(like 10), no problem, but if we increase to a bigger number, say 48 in my case, this program hangs every time... results = [pool.apply_async(job, (i,), callback = callback) for i in range(1)] pool.close() pool.join() log.info("Done") #loggingProcess.terminate() #serverProcess.terminate() ``` LoggerServer class is working as a logging Server(like a proxy), which manages a shared queue. LoggingProcess class is a log consumer class, which fetch the logs from the shared queue(managed by LoggingServer). Logger class is a producer class, which put the logs into the shared queue. As i want to share the global logger in multiple modules in order to unify the logs format/output places/...(something l
[issue43768] Possible race condition on multiprocessing.Manager().dict() on macOS
New submission from Jerry Chen : I am not sure if this is a bug or an expected case. Long story short, I tried to print the content of a `multiprocessing.Manager().dict()` in the main thread, but I got a strange error. I encountered this error only when the number of pools is rather large (>20) and only on `macOS` (works perfectly on `Linux`). Specs: ``` CPU: Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz macOS: 11.2.3 ``` The minimum err code is attached: ```python3 #!/usr/bin/env python3 from contextlib import suppress import multiprocessing as mp import time def run(): D[mp.current_process().name] = 'some val' time.sleep(0.5) if __name__ == '__main__': mp.set_start_method('fork') D, rets = mp.Manager().dict(), [] with mp.Pool(25) as p: for _ in range(33): rets.append(p.apply_async(run)) while rets: for ret in rets[:]: with suppress(mp.TimeoutError): ret.get(timeout=0) rets.remove(ret) print(len(D)) ``` Error: ``` multiprocessing.pool.RemoteTraceback: """ Traceback (most recent call last): File "/usr/local/Cellar/python@3.9/3.9.2_4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/managers.py", line 801, in _callmethod conn = self._tls.connection AttributeError: 'ForkAwareLocal' object has no attribute 'connection' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/local/Cellar/python@3.9/3.9.2_4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/pool.py", line 125, in worker result = (True, func(*args, **kwds)) File "/Users/???", line 9, in run D[mp.current_process().name] = 'some val' File "", line 2, in __setitem__ File "/usr/local/Cellar/python@3.9/3.9.2_4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/managers.py", line 805, in _callmethod self._connect() File "/usr/local/Cellar/python@3.9/3.9.2_4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/managers.py", line 792, in _connect conn = self._Client(self._token.address, authkey=self._authkey) File "/usr/local/Cellar/python@3.9/3.9.2_4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/connection.py", line 507, in Client c = SocketClient(address) File "/usr/local/Cellar/python@3.9/3.9.2_4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/connection.py", line 635, in SocketClient s.connect(address) ConnectionRefusedError: [Errno 61] Connection refused """ The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/Users/???", line 22, in ret.get(timeout=0) File "/usr/local/Cellar/python@3.9/3.9.2_4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/pool.py", line 771, in get raise self._value ConnectionRefusedError: [Errno 61] Connection refused ``` -- components: macOS messages: 390468 nosy: jerryc443, ned.deily, ronaldoussoren priority: normal severity: normal status: open title: Possible race condition on multiprocessing.Manager().dict() on macOS type: behavior versions: Python 3.9 ___ Python tracker <https://bugs.python.org/issue43768> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43533] Exception and contextmanager in __getattr__ causes reference cycle
New submission from Ran Chen : If __getattr__ raises exception within a contextlib.context_manager, it creates a reference cycle and prevents the frame from being garbage collected. This only happens if the exception is raised inside a context manager inside __getattr__. It doesn't happen if there's no context manager. Repro: ``` import contextlib import gc @contextlib.contextmanager def ct(): yield class A(object): def __getattr__(self, name): with ct(): raise AttributeError() def f(): a = A() hasattr(a, 'notexist') gc.set_debug(gc.DEBUG_LEAK) f() gc.collect() ``` It also doesn't happen if we catch the exception outside of the context manager and re-raise it: ``` def __getattr__(self, name): try: with ct(): raise AttributeError() except: raise ``` -- components: Library (Lib) messages: 388977 nosy: crccw priority: normal severity: normal status: open title: Exception and contextmanager in __getattr__ causes reference cycle type: behavior versions: Python 3.6 ___ Python tracker <https://bugs.python.org/issue43533> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43408] about the method: title()
New submission from Qihao Chen : Hello, I'm a student from China, and I think there is a bug in Python3.7. When I use the method "title()", I think the method should not make "'s" upper. I would appreciate it if you could consider my advice. -- files: title().png messages: 388153 nosy: chinkikoo227 priority: normal severity: normal status: open title: about the method: title() type: behavior versions: Python 3.7 Added file: https://bugs.python.org/file49852/title().png ___ Python tracker <https://bugs.python.org/issue43408> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43293] Move note about GIL to top of threading module
Change by Guanzhong Chen : -- keywords: +patch pull_requests: +23406 stage: -> patch review pull_request: https://github.com/python/cpython/pull/24622 ___ Python tracker <https://bugs.python.org/issue43293> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43293] Move note about GIL to top of threading module
New submission from Guanzhong Chen : The note about the GIL is buried pretty deep in the threading documentation, and this makes it hard for first time users to discover why their attempts at using threading to parallelizing their application did not work. This used to be the case in the old Python 2 documentation, but https://github.com/python/cpython/commit/d6d17c58af8002000ecd1326c7accafb5af8a9db moved it, and no corresponding discussion exists. I think the GIL is a pretty important thing to mention, especially for people used to other programming languages. I believe the change had a negative effect and should be reverted. -- assignee: docs@python components: Documentation messages: 387503 nosy: docs@python, quantum5 priority: normal severity: normal status: open title: Move note about GIL to top of threading module type: enhancement versions: Python 3.10, Python 3.6, Python 3.7, Python 3.8, Python 3.9 ___ Python tracker <https://bugs.python.org/issue43293> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43117] Translation Mistakes
New submission from chen-y0y0 : A example in this picture: In the red circles, the texts should not be translated. They should be their original states. Because these texts are options that programmers will input into their programs. If these texts are translated and input by that, the program will raise an error. In the green circke, the texts are not translated. -- assignee: docs@python components: Documentation files: 1E42294E-CA8F-4CAC-9AA7-79F3B05EE9D1.jpeg messages: 386209 nosy: docs@python, prasechen priority: normal severity: normal status: open title: Translation Mistakes type: behavior versions: Python 3.10, Python 3.6, Python 3.7, Python 3.8, Python 3.9 Added file: https://bugs.python.org/file49787/1E42294E-CA8F-4CAC-9AA7-79F3B05EE9D1.jpeg ___ Python tracker <https://bugs.python.org/issue43117> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue42915] enum.Flag ~ bitwise negation is very slow and can't be defined as a Flag value
Kevin Chen added the comment: Awesome thanks! Does the rewrite fix the issue with creating negated flags as well? -- ___ Python tracker <https://bugs.python.org/issue42915> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue42915] enum.Flag ~ bitwise negation is very slow and can't be defined as a Flag value
New submission from Kevin Chen : Here's a code sample: ``` import time from enum import Flag, auto class MyFlag(Flag): NONE = 0 FLAG_1 = auto() FLAG_2 = auto() FLAG_3 = auto() FLAG_4 = auto() FLAG_5 = auto() FLAG_6 = auto() # # NOT_FLAG_1_OR_2 = ~FLAG_1 & ~FLAG_2 def test_flag(): f = MyFlag.NONE inverted = ( ~MyFlag.FLAG_1 & ~MyFlag.FLAG_2 & ~MyFlag.FLAG_3 & ~MyFlag.FLAG_4 & ~MyFlag.FLAG_5 & ~MyFlag.FLAG_6 ) return f & inverted INVERTED = ( ~MyFlag.FLAG_1 & ~MyFlag.FLAG_2 & ~MyFlag.FLAG_3 & ~MyFlag.FLAG_4 & ~MyFlag.FLAG_5 & ~MyFlag.FLAG_6 ) def test_flag_cached(): f = MyFlag.NONE return f & INVERTED if __name__ == "__main__": start_time = time.time() for _ in range(10_000): test_flag() elapsed = time.time() - start_time print(f"Took normal {elapsed:2f} seconds.") start_time = time.time() for _ in range(10_000): test_flag_cached() elapsed = time.time() - start_time print(f"Took cached {elapsed:2f} seconds.") ``` And its outputs: ``` Took normal 1.799731 seconds. Took cached 0.009488 seconds. ``` Basically, bitwise negation is very very slow. From what I can tell, it seems that a lot of time is spent here computing powers of two. I've read elsewhere that flag values are cached, and it looks like negated Flag values can't be cached? This seems related to the second issue, which is that any negated Flag value being defined results in `RecursionError: maximum recursion depth exceeded` as it searches for a good name for Flag. Obviously, the simple workaround is just to define a constant variable elsewhere with the negated value, but it isn't very obvious anywhere that this is necessary, and I wanted to raise this to see if anyone has knowledge of the implementation details of Flag for possibly resolving this in the class itself. -- messages: 384983 nosy: aspin2 priority: normal severity: normal status: open title: enum.Flag ~ bitwise negation is very slow and can't be defined as a Flag value versions: Python 3.8 ___ Python tracker <https://bugs.python.org/issue42915> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue42912] enum.Flag ~ bitwise negation is very slow
New submission from Kevin Chen : Ignore this, opened issue by accident -- stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue42912> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue42912] enum.Flag ~ bitwise negation is very slow
Change by Kevin Chen : -- nosy: aspin2 priority: normal severity: normal status: open title: enum.Flag ~ bitwise negation is very slow versions: Python 3.8 ___ Python tracker <https://bugs.python.org/issue42912> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue41770] Import module doesn't updated
chen-y0y0 added the comment: --REOPEN-- >>> # I try: >>> import xxx >>> del sys.modules['xxx'] >>> # But: Traceback (most recent call last): File "", line 1, in del sys.modules['xxx'] NameError: name 'sys' is not found >>> # I try to import sys. >>> import sys >>> del sys.modules['xxx'] >>> import xxx >>> xxx.b Traceback (most recent call last): File "", line 1, in AttributeError: module 'xxx' has no attribute 'b' -- resolution: not a bug -> status: closed -> open ___ Python tracker <https://bugs.python.org/issue41770> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue41719] Why does not range() support decimals?
Change by chen-y0y0 : -- resolution: -> not a bug stage: needs patch -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue41719> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue41770] Import module doesn't updated
New submission from chen-y0y0 : # I create a module: # \sys.path\xxx.py a = 9 # And: >>> import xxx >>> xxx.a 9 # I delete this imported module and modified this module: del xxx # \sys.path\xxx.py a = 9 b = 8 # And re-import: >>> import xxx >>> xxx.b # But: Traceback (most recent call last): File "", line 1, in AttributeError: type object 'xxx' has no attribute 'b' -- components: Windows messages: 376766 nosy: paul.moore, prasechen, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: Import module doesn't updated type: resource usage versions: Python 3.8 ___ Python tracker <https://bugs.python.org/issue41770> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue41716] SyntaxError: EOL while scanning string literal
chen-y0y0 added the comment: Yep. -- ___ Python tracker <https://bugs.python.org/issue41716> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue41733] ContextVar get value is unexpected
New submission from Jason Chen : import asyncio from contextvars import * var = ContextVar('VarTest', default=None) def get_var(tag=None): obj = var.get() if obj is None: obj = object() var.set(obj) print(f'{tag=}: get_var result is {obj=}') return obj async def get_var_object(tag): return get_var(tag) async def asyncio_main(): await asyncio.gather(*[get_var_object(id) for id in range(2)]) def test(get_var_before_run=False): print(f'{get_var_before_run=}') if get_var_before_run: get_var() asyncio.run(asyncio_main()) print() if __name__ == '__main__': test(get_var_before_run=False) test(get_var_before_run=True) Output:--- tag=0: get_var result is obj= tag=1: get_var result is obj= get_var_before_run=True tag=None: get_var result is obj= tag=0: get_var result is obj= tag=1: get_var result is obj= --- my question: -- -- all objects in get_var_before_run=True are same. -- my expected result is all objects should be different, because the code runs in different context. -- components: asyncio messages: 376464 nosy: asvetlov, chenzep, yselivanov priority: normal severity: normal status: open title: ContextVar get value is unexpected versions: Python 3.8 ___ Python tracker <https://bugs.python.org/issue41733> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue41719] Why does not range() support decimals?
New submission from chen-y0y0 : # I try: >>> range(0,5,0.5) # I hope it will (0.0,0.5,1.0,1.5,2.0,2.5,3.0,3.5,4.0,4.5). But... Traceback (most recent call last): File "", line 1, in range(0,5,0.5) TypeError: 'float' object cannot be interpreted as an integer -- components: Argument Clinic messages: 376378 nosy: larry, prasechen priority: normal severity: normal status: open title: Why does not range() support decimals? type: compile error versions: Python 3.5, Python 3.6, Python 3.7, Python 3.8 ___ Python tracker <https://bugs.python.org/issue41719> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue41716] SyntaxError: EOL while scanning string literal
New submission from chen-y0y0 : # I try to run: import os os.system(r"start C:\Windows\System32\") # But I get an Exception: SyntaxError: EOL while scanning string literal # A string after “r” means the string's original meaning. But…… -- components: Argument Clinic messages: 376361 nosy: larry, prasechen priority: normal severity: normal status: open title: SyntaxError: EOL while scanning string literal type: compile error versions: Python 3.8 ___ Python tracker <https://bugs.python.org/issue41716> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue41236] "about" button in MacOS caused an error
New submission from Baozhen Chen : when clicking the MacOS menubar-File-About Python, it appears >>> can't invoke "tk_messageBox" command: application has been destroyed while executing "tk_messageBox -icon info -type ok -title [mc "About Widget Demo"] -message [mc "Tk widget demonstration application"] -detail "[mc "Copyright \u00a9..." (procedure "tkAboutDialog" line 2) invoked from within "tkAboutDialog" -- components: macOS messages: 373278 nosy: Baozhen Chen, ned.deily, ronaldoussoren priority: normal severity: normal status: open title: "about" button in MacOS caused an error type: behavior versions: Python 3.7 ___ Python tracker <https://bugs.python.org/issue41236> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40442] Spurious warning emitted during fork() can deadlock a multi-threaded process
Change by Bowie Chen : -- nosy: +bowiechen ___ Python tracker <https://bugs.python.org/issue40442> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40358] pathlib's relative_to should behave like os.path.relpath
Change by Bowie Chen : -- nosy: +bowiechen ___ Python tracker <https://bugs.python.org/issue40358> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue37527] Timestamp conversion on windows fails with timestamps close to EPOCH
Change by pingchao chen : -- keywords: +patch pull_requests: +17343 stage: resolved -> patch review pull_request: https://github.com/python/cpython/pull/15498 ___ Python tracker <https://bugs.python.org/issue37527> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38742] ElementTree won't parse comments before root element
New submission from yucheng chen : issue8277 It couldn't work for those comments before the root element. It will raise an error that "xml.etree.ElementTree.ParseError: multiple elements on top level". Example: test.xml test.py --- from xml.etree import ElementTree class MyTreeBuilder(ElementTree.TreeBuilder): def comment(self, data): self.start(ElementTree.Comment, {}) self.data(data) self.end(ElementTree.Comment) with open('c:/temp/t.xml', 'r') as f: xml = ElementTree.parse( f, parser=ElementTree.XMLParser(target=MyTreeBuilder())) ElementTree.dump(xml) -- components: XML messages: 356229 nosy: amaury.forgeotdarc, effbot, flox, poke, scoder, yucheng chen priority: normal severity: normal status: open title: ElementTree won't parse comments before root element type: enhancement versions: Python 3.6 ___ Python tracker <https://bugs.python.org/issue38742> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38571] Segfault with StopIteration
Kevin Chen added the comment: Sorry for the noise. I upgraded my gevent (1.3.5 to 1.4.0) and greenlet (0.4.13 to 0.4.15) libraries, and that appears to have resolved the issue. I assume there was an incompatibility in one or both of the older versions of these libraries with python 3.7, but I had not previously realized that they were causing the issue. -- resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue38571> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38571] Segfault with StopIteration
New submission from Kevin Chen : Unfortunately, I don't currently have a simple test case, but after migrating an app from python 3.6 to python 3.7, python frequently (but not always) segfaults when running tests for my app in code related to StopIteration (perhaps somehow related to the implementation of PEP 479?). I'm running a self-built (from python.org sources) unpatched build of Python 3.7.5 on Ubuntu Xenial. (The output below is edited to redact some path names.) Core was generated by `./python'. Program terminated with signal SIGSEGV, Segmentation fault. #0 0x0044cc40 in PyException_GetContext (self=self@entry=0x441cbe0) at Objects/exceptions.c:338 338 Py_XINCREF(context); (gdb) py-bt Traceback (most recent call first): File "lib/requests/models.py", line 750, in generate for chunk in self.raw.stream(chunk_size, decode_content=True): File "lib/requests/models.py", line 828, in content self._content = b''.join(self.iter_content(CONTENT_CHUNK_SIZE)) or b'' File "lib/requests/sessions.py", line 686, in send r.content File "lib/requests/sessions.py", line 533, in request resp = self.send(prep, **send_kwargs) File "lib/requests/sessions.py", line 546, in get return self.request('GET', url, **kwargs) [trace continues with other files specific to my app] (gdb) bt #0 0x0044cc40 in PyException_GetContext ( self=self@entry=) at Objects/exceptions.c:338 #1 0x0050b76d in PyErr_SetObject ( exception=, value=StopIteration()) at Python/errors.c:126 #2 0x0050ba17 in PyErr_SetNone (exception=) at Python/errors.c:163 #3 0x005d254d in gen_send_ex (gen=0x4351b00, arg=, exc=, closing=) at Objects/genobject.c:241 #4 0x00429406 in _PyEval_EvalFrameDefault (f=, throwflag=) at Python/ceval.c:2809 #5 0x005d20cb in gen_send_ex (gen=0x457c1b0, arg=, exc=, closing=) at Objects/genobject.c:221 #6 0x00459679 in list_extend (self=self@entry=0x445a590, iterable=iterable@entry=) at Objects/listobject.c:897 #7 0x0045de55 in _PyList_Extend (self=self@entry=0x445a590, iterable=iterable@entry=) at Objects/listobject.c:937 #8 0x005b76fc in PySequence_List ( v=v@entry=) at Objects/abstract.c:1905 #9 0x005b867d in PySequence_Fast (v=, m=m@entry=0x603715 "can only join an iterable") at Objects/abstract.c:1935 #10 0x00438e02 in stringlib_bytes_join (sep=b'', iterable=) at Objects/stringlib/join.h:22 #11 0x00445b53 in _PyMethodDef_RawFastCallKeywords ( method=0x8b0cc0 , self=self@entry=b'', args=args@entry=0x4322f20, nargs=nargs@entry=1, kwnames=kwnames@entry=0x0) at Objects/call.c:648 #12 0x005cfabf in _PyMethodDescr_FastCallKeywords ( descrobj=, args=args@entry=0x4322f18, nargs=nargs@entry=2, kwnames=kwnames@entry=0x0) at Objects/descrobject.c:288 #13 0x0042df85 in call_function (kwnames=0x0, oparg=2, pp_stack=) at Python/ceval.c:4593 #14 _PyEval_EvalFrameDefault (f=, throwflag=) at Python/ceval.c:3110 #15 0x004211c5 in function_code_fastcall (co=co@entry=0x3597c30, args=, args@entry=0x3ce1f08, nargs=nargs@entry=1, globals=globals@entry={'__name__': 'requests.models', '__doc__': '\nrequests.models\n~~~\n\nThis module contains the primary objects that power Requests.\n', '__package__': 'requests', '__loader__': , '__spec__': , origin='lib/requests/models.py', loader_state=None, submodule_search_locations=None, _set_fileattr=True, _cached='lib/requests/__pycache__/models.cpython-37.pyc', _initializing=False) at remote 0x354cd70>, '__file__': 'lib/requests/models.py', '__cached__': 'lib/requests/__pycache__/models.cpython-37.pyc', '__builtins__': {'__name__': 'builtins', '__doc__': "Built-in functions, exceptions, and other objects.\n\nNoteworthy: N...(truncated)) at Objects/call.c:283 #16 0x00445180 in _PyFunction_FastCallDict ( func=, args=0x3ce1f08, nargs=1, kwargs=0x0) at Objects/call.c:322 [remainder of trace redacted] Sometimes the C backtrace is slightly different, but very similar: Core was generated by `./python'. Program terminated with signal SIGSEGV, Segmentation fault. #0 PyErr_SetObject (exception=0x8b7c00 <_PyExc_StopIteration>, value=0x0) at Python/errors.c:101 101 Py_INCREF(exc_value); (gdb) bt #0 PyErr_SetObject (exception=, value=0x0) at Python/errors.c:101 #1 0x0050ba17 in PyErr_SetNone (exception=) at Python/errors.c:163 #2 0x005d254d in gen_send_ex (gen=0x3c71b10, arg=, exc=, closing=) at Objects/genobject.c:241 [rest of trace not listed, since it appears to be the same as the previous one] When running my app's tests, I've also seen one occurrence (possibly related to these crashes) when Python aborted because a reference count was -6. -- component
[issue34805] Explicitly specify `MyClass.__subclasses__()` returns classes in definition order
Luna Chen added the comment: Yes I am! :) Should I start looking into this? -- ___ Python tracker <https://bugs.python.org/issue34805> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22577] local variable changes lost after pdb jump command
Henry Chen added the comment: PEP 558 will fix this issue, which I've verified with the proposed implementation (https://github.com/python/cpython/pull/3640/files). Perhaps this issue can be closed? -- ___ Python tracker <https://bugs.python.org/issue22577> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue36988] zipfile: string IndexError on extract
KunYu Chen added the comment: Hi alter-bug-tracer, We notice about this pitfall when extracting zipbomb files. and we have discussion here https://bugs.python.org/issue36260 -- nosy: +18z ___ Python tracker <https://bugs.python.org/issue36988> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue36260] Cpython/Lib vulnerability found and request a patch submission
KunYu Chen added the comment: Thank you for the responses. I agree with Christian Heimes. It's indeed better to improve the documentation rather than directly implement the heuristic. -- ___ Python tracker <https://bugs.python.org/issue36260> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue36260] Cpython/Lib vulnerability found and request a patch submission
KunYu Chen added the comment: Thank you Karthikeyan Singaravelan. We're working on it :D Kunyu Chen -- ___ Python tracker <https://bugs.python.org/issue36260> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue36260] Cpython/Lib vulnerability found and request a patch submission
KunYu Chen added the comment: Dear community, I am one of the discoverer of this vulnerability, please tell us what to do next :D Kunyu Chen -- nosy: +18z ___ Python tracker <https://bugs.python.org/issue36260> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35892] Fix awkwardness of statistics.mode() for multimodal datasets
Change by Henry Chen : -- nosy: +scotchka ___ Python tracker <https://bugs.python.org/issue35892> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue28956] return list of modes for a multimodal distribution instead of raising a StatisticsError
Henry Chen added the comment: Yes, the mode function could ALWAYS return a list, but that breaks backward compatibility, as does the currently proposed change. -- ___ Python tracker <https://bugs.python.org/issue28956> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue28956] return list of modes for a multimodal distribution instead of raising a StatisticsError
Henry Chen added the comment: The problem remains that the function can return a number or a list for input that is a list of numbers. This means the user will need to handle both possibilities every time, which is a heavy burden for such a simple function. SciPy's mode function does return the minimum mode when there is a tie, which as far as I can tell is an arbitrary choice. But in that context, since the input is almost always numerical, a minimum is at least well defined, which is not true for an input with a mix of types. For the general use case, the current behavior - raising an exception - in case of tie conveys the most information. -- nosy: +scotchka ___ Python tracker <https://bugs.python.org/issue28956> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue36091] clean up async generator from types module
Change by Henry Chen : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue36091> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue36114] test_multiprocessing_spawn changes the execution environment
Henry Chen added the comment: Another example of this, same bot: https://buildbot.python.org/all/#/builders/168/builds/669 -- nosy: +scotchka ___ Python tracker <https://bugs.python.org/issue36114> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue36091] clean up async generator from types module
Henry Chen added the comment: As it happens @cheryl.sabella has created a very useful data set of which files are impacted by open PRs: https://github.com/csabella/pulls and as of 2019-02-18, the only open PR that relates to Lib/types.py is https://github.com/python/cpython/pull/5068 on an unrelated matter -- ___ Python tracker <https://bugs.python.org/issue36091> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue36091] clean up async generator from types module
Change by Henry Chen : -- keywords: +patch pull_requests: +12021 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue36091> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue36091] clean up async generator from types module
New submission from Henry Chen : the following script: ``` import sys, types def tr(frame, event, arg): print(frame, event, arg) return tr sys.settrace(tr) ``` gives the output: ``` call None exception (, GeneratorExit(), ) return None ``` This is due to Lib/types.py creating an async generator for the sole purpose of getting its type. I'll remove that reference after use to prevent the above message, which is probably benign but perhaps unnerving. -- components: Library (Lib) messages: 336368 nosy: scotchka priority: normal severity: normal status: open title: clean up async generator from types module type: behavior versions: Python 3.8 ___ Python tracker <https://bugs.python.org/issue36091> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35812] Don't log an exception from the main coroutine in asyncio.run()
Henry Chen added the comment: I'm having trouble reproducing this issue. The main_coro seems to disappear when an exception is raised in it, so that it does not show up in the set of tasks to cancel. I'm probably misunderstanding something basic here. Is it possible to provide a minimal example? -- nosy: +scotchka ___ Python tracker <https://bugs.python.org/issue35812> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue34782] Pdb crashes when code is executed in a mapping that does not define `__contains__`
Henry Chen added the comment: An attempt to clarify the issue in my own mind: def foo(): # import pdb; pdb.set_trace() exec('pass', {}, FakeContainer()) This function runs successfully. But if you uncomment the pdb line and then step thru in the pdb console, there is an Exception. I *think* the underlying principle is that code that runs normally should also run under pdb, which this example violates. However, to adhere to the principle 100% could be a very steep technical cost. Alternatively, I'd argue that the function should NOT run even without pdb, since exec requires a (complete) mapping type according to the documentation. Perhaps the thing to do is to add more stringent type checking to exec and eval? -- ___ Python tracker <https://bugs.python.org/issue34782> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue34782] Pdb crashes when code is executed in a mapping that does not define `__contains__`
Henry Chen added the comment: Hmm, the example works for me (Python 3.6.5): >>> import pdb >>> class FakeContainer: ... def __getitem__(self, key): ... raise KeyError(key) ... >>> pdb.run("eval('1+1',{},FakeContainer())") > (1)() (Pdb) c >>> As for exec/eval accepting an incomplete mapping, that strikes me as a less than thorough checking on the part of exec/eval, perhaps for performance reasons(?) -- ___ Python tracker <https://bugs.python.org/issue34782> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue34782] Pdb crashes when code is executed in a mapping that does not define `__contains__`
Henry Chen added the comment: I agree that this behavior is normal, unless there is a use case for passing a partially implemented mapping object to pdb.run. However I cannot think of such a use case. -- ___ Python tracker <https://bugs.python.org/issue34782> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue34782] Pdb crashes when code is executed in a mapping that does not define `__contains__`
Change by Henry Chen : -- nosy: +scotchka ___ Python tracker <https://bugs.python.org/issue34782> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35738] Update timeit documentation to reflect default repeat of five
Change by Henry Chen : -- title: Update timeit documentation to reflect default repeat of three -> Update timeit documentation to reflect default repeat of five ___ Python tracker <https://bugs.python.org/issue35738> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35738] Update timeit documentation to reflect default repeat of three
Change by Henry Chen : -- keywords: +patch, patch, patch pull_requests: +11196, 11197, 11198 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue35738> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35738] Update timeit documentation to reflect default repeat of three
Change by Henry Chen : -- keywords: +patch, patch pull_requests: +11196, 11197 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue35738> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35738] Update timeit documentation to reflect default repeat of three
Change by Henry Chen : -- keywords: +patch pull_requests: +11196 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue35738> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35509] Unable to inherit from logging.Formatter
Luna Chen added the comment: Hi Chih-Hsuan Yen, I have noticed in your `__init__` method, you have `super().__init__(self)`, I'm just wondering if the `self` argument is intentional, as the `Foo` object is to become the format itself? Because inheritance seems to work fine for me with `super().__init__()`, as super() is used for the parent class object, so I don't need to pass in the `self` for the object itself. the `self` in `super().__init__(self)` becomes the value of `fmt` argument.. -- ___ Python tracker <https://bugs.python.org/issue35509> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35509] Unable to inherit from logging.Formatter
Luna Chen added the comment: Hi Chih-Hsuan Yen, I will check this out and let you know the outcome. Thanks! :) -- ___ Python tracker <https://bugs.python.org/issue35509> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9633] pdb go stack up/down
Change by Henry Chen : -- pull_requests: +10309 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue9633> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22577] local variable changes lost after pdb jump command
Change by Henry Chen : -- nosy: +henry ___ Python tracker <https://bugs.python.org/issue22577> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16516] argparse types (and actions) must be hashable
Luna Chen added the comment: Hi bradengroom, I have reviewed your PR, it's just a small thing! If you could update your PR, it would be amazing! Thank you! -- nosy: +BNMetrics ___ Python tracker <https://bugs.python.org/issue16516> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35251] FTPHandler.ftp_open documentation error
Luna Chen added the comment: Hi there Lysandros, I'm happy to investigate into this and send a PR. I think we will need some test cases for this as well. Please let me know! :) -- nosy: +BNMetrics ___ Python tracker <https://bugs.python.org/issue35251> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue34805] Explicitly specify `MyClass.__subclasses__()` returns classes in definition order
Luna Chen added the comment: Hi Pekka Klärck, I would like to work on this issue and make a PR if you haven't done it yet. Thanks!:) -- nosy: +BNMetrics ___ Python tracker <https://bugs.python.org/issue34805> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue29341] Missing accepting path-like object in docstrings of os module functions
Change by Luna Chen : -- pull_requests: +9608 ___ Python tracker <https://bugs.python.org/issue29341> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue29341] Missing accepting path-like object in docstrings of os module functions
Change by Luna Chen : -- pull_requests: +9607 ___ Python tracker <https://bugs.python.org/issue29341> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue29341] Missing accepting path-like object in docstrings of os module functions
Change by Luna Chen : -- keywords: +patch pull_requests: +9434 stage: needs patch -> patch review ___ Python tracker <https://bugs.python.org/issue29341> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue29341] Missing accepting path-like object in docstrings of os module functions
Luna Chen added the comment: Farhaan Bukhsh: you said you wanted to work on this but that was over a month ago, so I presume you've directed your attention elsewhere, and I'd like to give this a try. -- nosy: +BNMetrics -thatiparthy ___ Python tracker <https://bugs.python.org/issue29341> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35002] Potential bug in ConfigParser.read() in python3.6, before os.Pathlike was introduced
Change by Luna Chen : -- resolution: -> out of date stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue35002> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35002] Potential bug in ConfigParser.read() in python3.6, before os.Pathlike was introduced
Luna Chen added the comment: Hi Berker, Yes this workaround is mostly for python3.6.0. I have noticed my PR won't let me get to that version it seems. :( This bug seems to be present for python 3.5 as well. Would you recommend adding the fix to 3.5 instead or just simply close it? Thanks very much! -- ___ Python tracker <https://bugs.python.org/issue35002> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35002] Potential bug in ConfigParser.read() in python3.6, before os.Pathlike was introduced
Change by Luna Chen : -- keywords: +patch pull_requests: +9274 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue35002> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35002] Potential bug in ConfigParser.read() in python3.6, before os.Pathlike was introduced
New submission from Luna Chen : In `configparser.ConfigParser.read()`, it allows us to pass in either a single filepath or a list of filepath. As python3 supports pathlib Path. We can potentially pass in a `PosixPath` to `configparser.ConfigParser.read()`, especially when passing in a list of `PosixPath` is allowed. However, passing in a single `PosixPath` causes it to raise an exception: File "/Users/bnmetrics/workspace/cpython/Lib/configparser.py", line 694, in read for filename in filenames: TypeError: 'PosixPath' object is not iterable This issue had been addressed with later version of python by checking if the filepath passed in is an instance of `os.Pathlike`. I thought it would be nice if we can pass in a single PosixPath object to `configparser.ConfigParser.read()`. -- messages: 327842 nosy: BNMetrics, gvanrossum, vinay.sajip priority: normal severity: normal status: open title: Potential bug in ConfigParser.read() in python3.6, before os.Pathlike was introduced type: behavior versions: Python 3.6 ___ Python tracker <https://bugs.python.org/issue35002> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue34844] logging.Formatter enhancement - Checking on style and fmt fields
Change by Luna Chen : -- keywords: +patch pull_requests: +9088 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue34844> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue34844] logging.Formatter enhancement - Checking on style and fmt fields
Luna Chen added the comment: Thank you Vinay! I think you have some good points! :) I'm going to make the following changes - re-raise the keyError into ValueError in XXXStyle.format - add validate() methods to XXXstyle class, and call them in logging.Formatter Best regards, Luna Chen -- ___ Python tracker <https://bugs.python.org/issue34844> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue34844] logging.Formatter enhancement - Checking on style and fmt fields
Change by Luna Chen : -- title: logging.Formatter enhancement - Checking on style and -> logging.Formatter enhancement - Checking on style and fmt fields ___ Python tracker <https://bugs.python.org/issue34844> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue34844] logging.Formatter enhancement - Checking on style and
New submission from Luna Chen : Issue: Currently logging.Formatter does not check if the format passed in is valid style or if the field is valid when creating the logging.Formatter object. It would be nice to have such check in the constructor of the logging.Formatter. Here are 2 scenarios: Scenario 1: Passing in invalid `fmt` when creating the logging.Formatter. Example: import logging logger = logging.getLogger('my_logger') handler = logging.StreamHandler() fmt = logging.Formatter("blah-blah", style="{") handler.setFormatter(fmt) logger.addHandler(handler) logger.setLevel(logging.DEBUG) logger.info('This is my logging message.') The above example would output the fmt string("blah-blah") whenever a logging operation is performed, such as `logging.info`, `logging.warning`. And this goes the same for mismatching style and fmt, like so: fmt = logging.Formatter("{asctime}-{message}", style="%") Scenario 2: Passing in invalid fields to logging.Formatter import logging logger = logging.getLogger('my_logger') handler = logging.StreamHandler() fmt = logging.Formatter("%(FuncName)s-%(message)s") handler.setFormatter(fmt) logger.addHandler(handler) logger.setLevel(logging.DEBUG) logger.info('This is my logging message.' ) As you can see from the above example, the "%(FuncName)s" field is misspelled with a capital "F", which should have been a lowercase "f". In this scenario, we would get an interesting stacktrace: --- Logging error --- Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/logging/__init__.py", line 992, in emit msg = self.format(record) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/logging/__init__.py", line 838, in format return fmt.format(record) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/logging/__init__.py", line 578, in format s = self.formatMessage(record) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/logging/__init__.py", line 547, in formatMessage return self._style.format(record) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/logging/__init__.py", line 391, in format return self._fmt % record.__dict__ KeyError: 'FuncName' Call stack: File "", line 1, in Message: 'This is my logging message.' Arguments: () Personally, I think the "KeyError" here can be misleading and confusing to some. Proposal: I would like to make a PR with the following changes: - Checking fmt to match the style in the constructor of logging.Formatting - When calling log message functions such as "logger.info()", an "extra" key word arg can be passed for custom format fields, for example: fmt = logging.Formatter("{cpuUsage} - {message}", style="{") # In this case, cpuUsage would be custom logger.info("my logging message", extra={"cpuUsage": "my_cpu_usage"}) - I would like to have custom fields passed in as an additional (optional) argument into the constructor for logging.Formatter - Another option is to have an additional member method for adding additional fields - I think we could essentially have both options - With this, we can remove the "extra" argument in Logger.makeRecord() Draw Backs: - This change might essentially break some existing code where someone might use the "extra" argument in log message functions, as we would do the check on logging.Formatter level Please let me know your thoughts, and I thought it would be nice to get some new ideas and areas I haven't thought about before I make this PR. Best regards, Luna Chen (BNMetrics) -- components: Library (Lib) messages: 326690 nosy: BNMetrics, gvanrossum priority: normal severity: normal status: open title: logging.Formatter enhancement - Checking on style and type: enhancement versions: Python 3.6 ___ Python tracker <https://bugs.python.org/issue34844> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue34516] httplib sets unbefitting "Host" in request header when requests an ipv6 format url.
chen wu added the comment: to fix this, we change the code of our urilib3. before passing params to httplib, we set Host in headers if it's ipv6 address. Thanks so much. -- resolution: duplicate -> not a bug stage: -> resolved status: pending -> closed ___ Python tracker <https://bugs.python.org/issue34516> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue34550] UnicodeDecodeError when invoke method configure() of Menu instance
New submission from Tao Chen : [Brief Description] Python 3.7.0 IDLE. After create one Menu instance, and invoke it's config() or configure() method without any parameter, python print UnicodeDecodeError. [Walk around] menubar = Menu(root) menubar.config(font=('Arial')) [LOG] Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)] on win32 Type "copyright", "credits" or "license()" for more information. >>> from tkinter import * >>> root = Tk() >>> menubar = Menu(root) >>> menubar.config() Traceback (most recent call last): File "", line 1, in menubar.config() UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc8 in position 2: invalid continuation byte >>> menubar.cget('font') Traceback (most recent call last): File "", line 1, in menubar.cget('font') UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc8 in position 2: invalid continuation byte >>> platform.uname() uname_result(system='Windows', node='xxx', release='7', version='6.1.7601', machine='AMD64', processor='Intel64 Family 6 Model 78 Stepping 3, GenuineIntel') -- components: Tkinter messages: 324389 nosy: sbellct priority: normal severity: normal status: open title: UnicodeDecodeError when invoke method configure() of Menu instance type: resource usage versions: Python 3.7 ___ Python tracker <https://bugs.python.org/issue34550> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue34516] httplib sets unbefitting "Host" in request header when requests an ipv6 format url.
chen wu added the comment: yeah, i noticed that. but this function also return host with '[]'. 183# IPv6 184if url and url[0] == '[': 185host, url = url.split(']', 1) 186host += ']' if url is [aaa:bbb]:123, host is [aaa:bbb] and url is ':123'after this process. when host=[aaa:bbb] passed to httplib.HTTPConnection, its function 'putrequest' will put 'Host:[[aaa:bbb]]:123' in headers. -- ___ Python tracker <https://bugs.python.org/issue34516> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue34516] httplib sets unbefitting "Host" in request header when requests an ipv6 format url.
chen wu added the comment: Thanks so much for your reply. when httplib.HTTPConnection is inited with host [fc00::0a08::2] and port 35357, we can make a request normally. only the 'Host' set in header is wrong. I think the most simple way to fix this is adding judgement condition, maybe like this: 974# Wrap the IPv6 Host Header with [] (RFC 2732) 975if host_enc.find(':') >= 0 and host_enc.find(']') < 0: 976host_enc = "[" + host_enc + "]" or rules should be given, because when port is not default, only (host=[aaa:bbb]:123, port=None) and (host=aaa:bbb, port=123) are valid for httplib now. so sorry for my poor English. hope you can understand what im saying. :) -- ___ Python tracker <https://bugs.python.org/issue34516> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue34516] httplib sets unbefitting "Host" in request header when requests an ipv6 format url.
New submission from chen wu : when I tried to request a url like "https://[fc00:0a08::2]:35357", I got 400. The code is like: import requests requests.get("https://[fc00:0a08::2]:35357;, verify=False) And the apache logs: vhost.c(889): [client fc00:ac1c::9a5:58692] AH00550: Client sent malformed Host header: [[fc00::0a08::2]]:35357 If user no set "Host" in header, httpslib will pase it from url and set it. The paser function is urllib3.util.url.pase_url. When url is "https://[fc00:0a08::2]:35357;, we got host [fc00:0a08::2]. And then httplib sets host in putrequest, "[" and "]" will be added to [fc00:0a08::2], which is not a valid format for host. The part of codes are: 974# Wrap the IPv6 Host Header with [] (RFC 2732) 975if host_enc.find(':') >= 0: 976host_enc = "[" + host_enc + "]" maybe the judgement condition for wrap ipv6 host header with [] is not very well? -- components: Library (Lib) messages: 324149 nosy: visionwun priority: normal severity: normal status: open title: httplib sets unbefitting "Host" in request header when requests an ipv6 format url. type: behavior versions: Python 2.7 ___ Python tracker <https://bugs.python.org/issue34516> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue33989] ms.key_compare is not initialized in all pathes of list_sort_impl
New submission from Pochang Chen : Relevant code (Objects/listobject.c lines 2268 -- 2286 as of commit e76ac9d): /* Choose the best compare, given what we now know about the keys. */ if (keys_are_all_same_type) { if (key_type == _Type && strings_are_latin) { ms.key_compare = unsafe_latin_compare; } else if (key_type == _Type && ints_are_bounded) { ms.key_compare = unsafe_long_compare; } else if (key_type == _Type) { ms.key_compare = unsafe_float_compare; } else if ((ms.key_richcompare = key_type->tp_richcompare) != NULL) { ms.key_compare = unsafe_object_compare; } } else { ms.key_compare = safe_object_compare; } Clearly, ms.key_compare is not assigned here if keys_are_all_same_type is true but key_type->tp_richcompare is NULL. I don't know how to obtain an object with ob_type->tp_richcompare being NULL, though. -- components: Interpreter Core messages: 320679 nosy: johnchen902 priority: normal severity: normal status: open title: ms.key_compare is not initialized in all pathes of list_sort_impl type: crash versions: Python 3.7, Python 3.8 ___ Python tracker <https://bugs.python.org/issue33989> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20891] PyGILState_Ensure on non-Python thread causes fatal error
Change by Kevin Chen <kc...@mit.edu>: -- nosy: +kchen ___ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue20891> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue32016] Python 3.6.3 venv FAILURE
New submission from Larry Chen <larry.c...@microsemi.com>: Upgraded from 3.6.1 to 3.6.3; but got an error when trying to create my virtual environment. [larrchen@rslab239 Larry]$ /opt/python3.6.3/bin/python3.6 -m venv /u/larrchen/work2/SAN/Users/Larry/rslab239_myENV_363 Error: Command '['/u/larrchen/work2/SAN/Users/Larry/rslab239_myENV_363/bin/python3.6', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1. I can create a virtual env for 3.6.1 and 3.6.2 but not for 3.6.3. This is a regression issue. Try this command. It fails every time. python3.6 -m venv myEnv Larry -- messages: 306165 nosy: nihon2000 priority: normal severity: normal status: open title: Python 3.6.3 venv FAILURE versions: Python 3.6 ___ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue32016> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue31062] socket.makefile does not handle line buffering
New submission from Kevin Chen: File objects generated with socket.makefile and that attempt to use line buffering appear to not actually use line buffering, at least for writing. In this example, the string does not appear to be written until the flush call. First, set up a socket: $ nc -l -U /tmp/foo Then: Python 3.6.2 (default, Jul 26 2017, 01:41:27) [GCC 4.8.4] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import socket >>> s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) >>> s.connect("/tmp/foo") >>> f = s.makefile("rw", buffering=1) >>> f.write("asdf\n") 5 >>> f.flush() The following patch appears to fix the problem: --- socket.py.orig 2017-07-25 21:41:39.974554944 -0400 +++ socket.py 2017-07-27 17:02:58.223353418 -0400 @@ -253,7 +253,11 @@ buffer = io.BufferedWriter(raw, buffering) if binary: return buffer -text = io.TextIOWrapper(buffer, encoding, errors, newline) +line_buffering = False +if buffering == 1: +line_buffering = True +text = io.TextIOWrapper(buffer, encoding, errors, newline, +line_buffering) text.mode = mode return text -- components: Library (Lib) messages: 299351 nosy: kchen priority: normal severity: normal status: open title: socket.makefile does not handle line buffering type: behavior versions: Python 3.6 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue31062> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30996] add coroutine AbstractEventLoop.sock_close
New submission from Fengyuan Chen: I suppose asyncio lack async version of sock_close that can call loop.remove_reader and others before close socket and perhaps lack something like coroutine AbstractEventLoop.sock_make_blocking that can do some deregister job. switch constant in the script: * change CALL_REMOVE_READING_BEFORE_CLOSE to True will make script running smoothly * change USE_UVLOOP to True will make script use uvloop -- components: asyncio files: asyncio_wait_forever.py messages: 298894 nosy: cfy, yselivanov priority: normal severity: normal status: open title: add coroutine AbstractEventLoop.sock_close type: resource usage versions: Python 3.6 Added file: http://bugs.python.org/file47034/asyncio_wait_forever.py ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30996> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30422] Add roadmap.txt section to idlelib
KunYu Chen added the comment: Thanks Terry, I'll focus on the current tests. Will catch up with you guys later. :D -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30422> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue29876] Check for null return value [_elementtree.c : subelement]
New submission from Alex CHEN: In file _elementtree.c our static code scanner has reported this case, I think there is a bit similar to http://bugs.python.org/issue29874 (returns NULL when NoMemory) static PyObject* subelement(PyObject* self, PyObject* args, PyObject* kw) { PyObject* elem; ElementObject* parent; PyObject* tag; PyObject* attrib = NULL; if (!PyArg_ParseTuple(args, "O!O|O!:SubElement", _Type, , , _Type, )) return NULL; if (attrib || kw) { attrib = (attrib) ? PyDict_Copy(attrib) : PyDict_New(); if (!attrib) return NULL; if (kw) PyDict_Update(attrib, kw); } else { Py_INCREF(Py_None); attrib = Py_None; } elem = element_new(tag, attrib); // <== element_new could returns a NULL pointer, the followed Py_DECREF(elem) would dereference NULL pointer. Py_DECREF(attrib); if (element_add_subelement(parent, elem) < 0) { Py_DECREF(elem); return NULL; } -- components: XML messages: 289972 nosy: alexc priority: normal severity: normal status: open title: Check for null return value [_elementtree.c : subelement] type: crash versions: Python 2.7 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue29876> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue29874] Need a look for return value checking [selectmodule.c]
Changes by Alex CHEN <al...@sbrella.com>: -- type: -> crash ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue29874> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue29874] Need a look for return value checking [selectmodule.c]
New submission from Alex CHEN: In file selectmodule.c our static code scanner has reported the following case, function set2list is liable to return NULL (if PyTuple_New failed), would any chance the NULL pointer be dereferenced (Py_DECREF(fdlist) after set2list) or it would just raise python exception to handle PyTuple_New error ? static PyObject * select_select(PyObject *self, PyObject *args) { .. if (n < 0) { PyErr_SetFromErrno(SelectError); } #endif else { /* any of these three calls can raise an exception. it's more convenient to test for this after all three calls... but is that acceptable? */ ifdlist = set2list(, rfd2obj); // || <= ofdlist = set2list(, wfd2obj); // || efdlist = set2list(, efd2obj); // || if (PyErr_Occurred()) ret = NULL; else ret = PyTuple_Pack(3, ifdlist, ofdlist, efdlist); Py_DECREF(ifdlist); Py_DECREF(ofdlist); Py_DECREF(efdlist); -- messages: 289967 nosy: alexc priority: normal severity: normal status: open title: Need a look for return value checking [selectmodule.c] ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue29874> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue29873] Need a look for return value checking [_elementtree.c]
New submission from Alex CHEN: In file _elementtree.c our static code scanner has reported this case, but I don't sure that could be any problem, may you have a look? static PyObject* element_getattr(ElementObject* self, char* name) { PyObject* res; /* handle common attributes first */ if (strcmp(name, "tag") == 0) { res = self->tag; Py_INCREF(res); return res; } else if (strcmp(name, "text") == 0) { res = element_get_text(self); // is it possible that element_get_text could return NULL here? Py_INCREF(res); return res; } -- components: XML messages: 289965 nosy: alexc priority: normal severity: normal status: open title: Need a look for return value checking [_elementtree.c] type: crash versions: Python 2.7 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue29873> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com