[issue36078] argparse: positional with type=int, default=SUPPRESS raise ValueError
yang added the comment: I ran into the same issue and looked into the code, and found it more complicated than I thought. The more I went on, more issues occur. I wonder if I should open a new issue, but I will first comment here. If you feel like this should be a new issue, I will open one then. And I apologize in advance for possible vaguenesses in this comment because I modified it several times as I explored the code and found more issues. (also because of my poor English):) It seems the issue happens only on positional arguments but not optional ones. Empty optional arguments will not call `take_action` and default values are handled and converted after consuming all arguments. It also leads to inconsistancy between positional and optional arguments behaviour. Positional arguments always go through `take_action`, but optional arguments don't if an argument doesn't appear. This inconsistancy causes another I think is strange behaviour, parser = ArgumentParser() parser.add_argument('i', action='count') parser.parse_args([]) got Namespace(i=1) On the other hand, in `_get_values` function, `_check_value` is called to handle `choices=`, but there is no such guard for optional arguments, which means, parser = ArgumentParser() parser.add_argument('-i', nargs='?', type=int, default='2', choices=[1]) parser.parse_args([]) doesn't raise an error. Besides Paul's two instructive solutions, I think it better to make both sides behave the same. However, I found things seem not that simple. First, ZERO_OR_MORE, no default value, positional arguments have `required=True` by default, but parser.add_argument('foo', nargs='*') parser.parse_args([]) got no problems. So it at least appears not required. (The document says `required` is only for optionals, so I guess it's just a implementation level but not a user level thing) Second, the last case above gives Namespace(foo=[]) which seems logically incorrect or at least controversial, because the default is not set and you give no arguments, how does this list come? The document says nothing about the case (it's true it's a very corner one) and it also differs from the optional arguments case which gives Namespace(foo=None) A walk around which doesn't change it is possible and I've written a patch fixing it. And I'm not sure what we usually do if I propose to make them give the same result, is a PEP needed or I just raise a discussion about it? The change might break current code. -- nosy: +fhsxfhsx ___ Python tracker <https://bugs.python.org/issue36078> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38921] Max Recursion Depth Reached in Logging Library
yang added the comment: You assigned a handler to a variable `formatter`, and then called `setFormatter(formatter)`, but `formatter` is in fact a handler. The two classes `Formatter` and `Handler` happen to have a same name method `format` which is called when logging. So what happend is the logger wants to format your logging string, and it calls its handlers' `format` method. And in this handler's `format` method, the handler calls its formatter's `format` method, which ends to be another handler rather than a real formatter. And you repeated it 1000 times, which caused a 1000-level nested recursion. -- nosy: +fhsxfhsx ___ Python tracker <https://bugs.python.org/issue38921> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35212] Expressions with format specifiers in f-strings give wrong code position in AST
Change by yang : -- keywords: +patch nosy: +fhsxfhsx nosy_count: 2.0 -> 3.0 pull_requests: +18760 stage: -> patch review pull_request: https://github.com/python/cpython/pull/19398 ___ Python tracker <https://bugs.python.org/issue35212> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue32729] socket error handling needed
yang added the comment: If socket error occurred I think it is a timeout error or something. but It's not error raising correctly but IndexError which is not correct error MSG. It will be fixed or None type check needed. -- resolution: -> fixed ___ Python tracker <https://bugs.python.org/issue32729> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue32729] socket error handling needed
Change by yang : -- keywords: +patch pull_requests: +5286 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue32729> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue32729] socket error handling needed
yang added the comment: In the lib/socket.py Inside of readinto function, 576 line needed None type check or something -- ___ Python tracker <https://bugs.python.org/issue32729> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue32729] socket error handling needed
yang added the comment: When timeout error occurred in urllib3.Poolmanager.urlopen(), the built-in TimeoutError raised which is not caught in existing timeout exception clause. Thus, It is caught by 'error' except and it is not checking Nonetype so that raising IndexError It patched that error and detailed in PR-5458 https://github.com/python/cpython/pull/5458 Thank you and sorry for not good at english. -- ___ Python tracker <https://bugs.python.org/issue32729> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue32729] socket error handling needed
yang added the comment: Oh.. you are right. I think it's my bug. here is code ``` import urllib3 import certifi from functools import wraps import signal from urllib3 import Timeout def timeoutdec(sec): def decorator(func): def _timeout(signum, frame): raise TimeoutError() @wraps(func) def wrapper(*args, **kwargs): signal.signal(signal.SIGALRM, _timeout) signal.alarm(sec) try: result = func(*args, **kwargs) finally: signal.alarm(0) return result return wrapper return decorator @timeoutdec(2) def for_test(): timeout = Timeout(connect=10.0, read=2.0) url = 'http://httpbin.org/delay/7' method = 'GET' body = None headers = None http = urllib3.PoolManager(timeout=timeout, cert_reqs='CERT_REQUIRED', ca_certs=certifi.where()) while True: response = http.urlopen(method, url, body=body, headers=headers, preload_content=True) print(response.data) for_test() ``` here is the code that i got same traceback. maybe the TimeoutError is raised from my code, timeoutdec(). I thought it was python bug. sorry for bothering you. and I will close my PR-32729. -- ___ Python tracker <https://bugs.python.org/issue32729> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6728] To avoid hang up in using CGIXMLRPCRequestHandler under IIS 7.x
New submission from Yang : The mismatched content length will cause hang up in sys.stdin.read(). The reason is probably described in Issue 1214 as well as 1725295. length = int(os.environ.get('CONTENT_LENGTH', None)) """Length fix for IIS 7.x to avoid hang up""" length=length-2 I would appreciate if someone can create a diff or patch file for the code above. -- components: Library (Lib) messages: 91707 nosy: sjtuer severity: normal status: open title: To avoid hang up in using CGIXMLRPCRequestHandler under IIS 7.x type: feature request versions: Python 2.6 ___ Python tracker <http://bugs.python.org/issue6728> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46179] Delete selected item generate "<>" event or not in different version of tkinter or Python
New submission from Jason Yang : In python(3.8.10)/tkinter(8.6.9), it won't generate "<>" event if we delete selected item of ttk.Treeview, but it will for python(3.9.9/3.10.1)/tkinter(8.6.12). Check it just by clicking 'Delete Item 1' button in following demo code ```python import sys from random import randint from datetime import datetime import tkinter as tk from tkinter import ttk def button_callback(): button.configure(state='disabled') treeview.delete(1) def treeview_callback(event): print(datetime.now().strftime("%H:%M:%S"), "Treeview selection changed !") print(f"Python version : {sys.version.split(' ')[0]}") print(f"tkinter version: {tk.Tcl().eval('info patchlevel')}") columns = ('President', 'Birthday') data = [ ('Ronald Reagan', 'February 6'), ('Abraham Lincoln', 'February 12'), ('George Washington', 'February 22'), ('Andrew Jackson', 'March 15'), ('Thomas Jefferson', 'April 13'), ] root = tk.Tk() treeview = ttk.Treeview(root, columns=columns, height=5, show='headings') treeview.pack() for column in columns: treeview.heading(column, text=column) treeview.column(column, width=150) for i, row in enumerate(data): treeview.insert('', i, iid=i, text=str(i), values=row) treeview.selection_set(1) button = tk.Button(root, text='Delete Item 1', command=button_callback) button.pack() treeview.bind("<>", treeview_callback) root.mainloop() ``` ```python d:\>python test3.py Python version : 3.8.10 tkinter version: 8.6.9 17:57:43 Treeview selection changed ! d:\>python test3.py Python version : 3.9.9 tkinter version: 8.6.12 17:58:10 Treeview selection changed ! 17:58:11 Treeview selection changed ! d:\>python test3.py Python version : 3.10.1 tkinter version: 8.6.12 18:01:10 Treeview selection changed ! 18:01:12 Treeview selection changed ! ``` -- components: Tkinter messages: 409185 nosy: Jason990420 priority: normal severity: normal status: open title: Delete selected item generate "<>" event or not in different version of tkinter or Python type: behavior versions: Python 3.10, Python 3.8, Python 3.9 ___ Python tracker <https://bugs.python.org/issue46179> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46180] Button clicked failed when mouse hover tooltip and tooltip destroyed
New submission from Jason Yang : Button no response when clicked if mouse move into tooltip and tooltip destroyed for Python 3.9.9/3.10.1 and tkinter 8.6.12 You can check it by moving mouse into button, then move to tooltip after it shown, then click button and you won't get response for button clicked, but "Leave". It is OK for lower version of Python/tkinter. ```python import sys from datetime import datetime import tkinter as tk class Tooltip(object): """ create a tooltip for a given widget """ def __init__(self, widget, text='widget info'): self.waittime = 500 # miliseconds self.widget = widget self.text = text self.widget.bind("", self.enter) self.widget.bind("", self.leave) self.widget.bind("", self.leave) self.id = None self.top = None def enter(self, event=None): print(now(), "Enter") self.schedule() def leave(self, event=None): print(now(), "Leave") self.unschedule() self.hidetip() def schedule(self): self.unschedule() self.id = self.widget.after(self.waittime, self.showtip) def unschedule(self): id = self.id self.id = None if id: self.widget.after_cancel(id) def showtip(self, event=None): x = y = 0 x, y, cx, cy = self.widget.bbox("insert") x += self.widget.winfo_rootx() + self.widget.winfo_width()//2 y += self.widget.winfo_rooty() + self.widget.winfo_height()//2 self.top = tk.Toplevel(self.widget) self.top.wm_overrideredirect(True) self.top.wm_geometry("+%d+%d" % (x, y)) label = tk.Label(self.top, text=self.text, bd=1, font=font, relief='solid') label.pack(ipadx=1) def hidetip(self): top = self.top self.top = None if top: top.destroy() def now(): return datetime.now().strftime("%H:%M:%S") print(f"Python version : {sys.version.split(' ')[0]}") print(f"tkinter version: {tk.Tcl().eval('info patchlevel')}") font = ("Courier New", 40) root = tk.Tk() button = tk.Button(root, text="button", font=font, command=lambda:print(now(), 'Button clicked')) button.pack(padx=10, pady=5) tooltip = Tooltip(button, 'This is button 1') root.mainloop() ``` ```python d:\>python test.py Python version : 3.10.1 tkinter version: 8.6.12 18:21:52 Enter (Mouse to button) 18:21:54 Leave (mouse to tooltip) 18:21:55 Leave (button clicked get no response) 18:21:57 Leave (button clicked get no response) 18:21:58 Leave (button clicked get no response) d:\>python test.py Python version : 3.9.9 tkinter version: 8.6.12 18:22:51 Enter (Mouse to button) 18:22:54 Leave (mouse to tooltip) 18:22:55 Leave (button clicked get no response) 18:22:56 Leave (button clicked get no response) 18:22:57 Leave (button clicked get no response) d:\>python test.py Python version : 3.8.10 tkinter version: 8.6.9 18:23:22 Enter (Mouse to button) 18:23:23 Leave (mouse to tooltip) 18:23:23 Enter (mouse stay, and it will repeat `Enter and Leave` again and again) 18:23:24 Leave ... 18:23:28 Enter 18:23:28 Leave 18:23:28 Button clicked (button clicked get response) 18:23:31 Leave 18:23:31 Button clicked (button clicked get response) 18:23:32 Leave ``` Platform - WIN10 -- components: Tkinter messages: 409188 nosy: Jason990420 priority: normal severity: normal status: open title: Button clicked failed when mouse hover tooltip and tooltip destroyed type: crash versions: Python 3.10, Python 3.8, Python 3.9 ___ Python tracker <https://bugs.python.org/issue46180> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46179] Delete selected item generate "<>" event or not in different version of tkinter or Python
Jason Yang added the comment: >From https://core.tcl-lang.org/tk/reportlist, I found the same issue ttk::treeview <> event bug https://core.tcl-lang.org/tk/tktview?name=2a6c62afd9 It is an old bug from 2014 anf not fixed, and now it fixed. OK, no more question about it. Thank you for your information. B.R., Jason Yng -- resolution: -> fixed stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue46179> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46464] concurrent.futures.ProcessPoolExecutor can deadlock when tcmalloc is used
New submission from Yilei Yang : When Python is built and linked with tcmalloc, using ProcessPoolExecutor may deadlock. Here is a reproducible example: $ cat t.py from concurrent import futures import sys def work(iteration, item): sys.stdout.write(f'working: iteration={iteration}, item={item}\n') sys.stdout.flush() for i in range(0, 1): with futures.ProcessPoolExecutor(max_workers=2) as executor: executor.submit(work, i, 1) executor.submit(work, i, 2) $ python t.py working: iteration=0, item=1 working: iteration=0, item=2 working: iteration=1, item=1 working: iteration=1, item=2 ... working: iteration=3631, item=1 working: iteration=3631, item=2 The child process fails to finish. It's more likely to reproduce when the system is busy. With some bisect search internally, this commit https://github.com/python/cpython/commit/1ac6e379297cc1cf8acf6c1b011fccc7b3da2cbe "triggered" the deadlock threshold with tcmalloc. -- components: Library (Lib) messages: 411208 nosy: yilei priority: normal severity: normal status: open title: concurrent.futures.ProcessPoolExecutor can deadlock when tcmalloc is used versions: Python 3.10, Python 3.11, Python 3.9 ___ Python tracker <https://bugs.python.org/issue46464> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35095] Implement pathlib.Path.append_bytes and pathlib.Path.append_text
Keelung Yang added the comment: @pitrou Firstly, I can't agree with `it is quite uncommon to open a file in append mode`. It should be depended to users and their application scenes. @pablogsal Secondly, I think `Path.write_*(, append=False)` is better then adding new APIs, as discussed in https://stackoverflow.com/questions/57296168/pathlib-path-write-text-in-append-mode -- nosy: +keelung-yang ___ Python tracker <https://bugs.python.org/issue35095> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46525] datetime.timestamp() lose precision when the time is too large
New submission from Yilei Yang : Examples: >>> datetime.datetime(, 1, 1, microsecond=99).timestamp() 7952371200.99 >>> datetime.datetime(, 1, 1, microsecond=99).timestamp() 43012195201.0 >>> datetime.datetime(2567, 1, 1, microsecond=98).timestamp() 18839548800.96 I believe this is an issue caused by using `double` in the C implementation. -- components: Library (Lib) messages: 411676 nosy: yilei priority: normal severity: normal status: open title: datetime.timestamp() lose precision when the time is too large type: behavior versions: Python 3.10, Python 3.11, Python 3.7, Python 3.8, Python 3.9 ___ Python tracker <https://bugs.python.org/issue46525> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46554] Add append keyword argument to Path.write_text() and Path.write_bytes()
New submission from Keelung Yang : Three reasons to improve issue 35095: Implement pathlib.Path.append_bytes and pathlib.Path.append_text 1. If I want to append text to log at each startup(before calling basicConfig), there is no simple way to do this. 2. Adding append keyword is better then adding new APIs. 3. From stackoverflow: How does this make the classes clean? They already contain the write_* methods which are just not flexible enough. If the methods (or classes) are not dirty how would e.g. adding an optional parameter append=False to them make them dirty? https://stackoverflow.com/questions/57296168/pathlib-path-write-text-in-append-mode So, this patch is just an implementation of discussions in above stackoverflow link. -- files: add-append-arg-to-path.write.patch keywords: patch messages: 411929 nosy: keelung-yang priority: normal severity: normal status: open title: Add append keyword argument to Path.write_text() and Path.write_bytes() Added file: https://bugs.python.org/file50591/add-append-arg-to-path.write.patch ___ Python tracker <https://bugs.python.org/issue46554> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46554] Add append keyword argument to Path.write_text() and Path.write_bytes()
Change by Keelung Yang : -- components: +Library (Lib) type: -> enhancement versions: +Python 3.11 ___ Python tracker <https://bugs.python.org/issue46554> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46554] Add append keyword argument to Path.write_text() and Path.write_bytes()
Keelung Yang added the comment: @barneygale, This is for simplifying code and improve readability, since `Readability counts` in The Zen of Python. Users needn't two lines code to append a file. And there is a minimal modifying to reach it. If inexperienced users are falling into the hole, just let them in and then learned sth. Because they will go out of the hole sooner or later. And finally, two lines cann't prevent them from falling into the hole. -- ___ Python tracker <https://bugs.python.org/issue46554> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46554] Add append keyword argument to Path.write_text() and Path.write_bytes()
Keelung Yang added the comment: This shouldn't be limited logging. In unstable application scene, file should be append and then close immediately to avoid breaking filesystem (e.g. inode is not updated timely). Such as main.py file in MicroPython development board, user may disconnect USB or press reset at anytime without ejecting disk. Or in IVI system, some embedded devices, record should be appended immediately. And if path.write(append=) is not common enough, then what's about built-in function open()? What's the purpose of adding read/write functions to pathlib.Path? -- ___ Python tracker <https://bugs.python.org/issue46554> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46554] Add append keyword argument to Path.write_text() and Path.write_bytes()
Keelung Yang added the comment: In file operations, write/modify/append, which one is generic/common? They're all. Modifying need more then one line code, but write/oppend needn't. Two lines are bad to readability and readability counts. How do you determine it's not common enough? There're many kind of users and application scene, and this feature is even not existed. Should we create a poll both to Python developers and it's users? -- ___ Python tracker <https://bugs.python.org/issue46554> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46554] Add append keyword argument to Path.write_text() and Path.write_bytes()
Keelung Yang added the comment: Without append kwarg, users need two lines to append. It's bad to both readability and writability. Library developers should focus on bath language and library's design targets, but how frequently used. And as all discussed here, at least one applications scene(logging) benefited from append kwarg. Right? -- ___ Python tracker <https://bugs.python.org/issue46554> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46180] Button clicked failed when mouse hover tooltip and tooltip destroyed
Jason Yang added the comment: The platform is WIN10 which shown at last line in first message. I don't have other platforms to test if ok or not. -- ___ Python tracker <https://bugs.python.org/issue46180> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46554] Add append keyword argument to Path.write_text() and Path.write_bytes()
Keelung Yang added the comment: OK. Since most are opposed to append kwarg, I close this issue. Thanks ALL! -- resolution: -> wont fix stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue46554> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46784] Duplicated symbols when linking embedded Python with libexpat
New submission from Yilei Yang : The libexpat 2.4.1 upgrade from https://bugs.python.org/issue44394 introduced the following new exported symbols: testingAccountingGetCountBytesDirect testingAccountingGetCountBytesIndirect unsignedCharToPrintable XML_SetBillionLaughsAttackProtectionActivationThreshold XML_SetBillionLaughsAttackProtectionMaximumAmplification We need to adjust Modules/expat/pyexpatns.h (The newer libexpat upgrade https://bugs.python.org/issue46400 has no new symbols). I'll send a PR. -- components: XML messages: 413464 nosy: yilei priority: normal severity: normal status: open title: Duplicated symbols when linking embedded Python with libexpat versions: Python 3.10, Python 3.11, Python 3.7, Python 3.8, Python 3.9 ___ Python tracker <https://bugs.python.org/issue46784> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46784] Duplicated symbols when linking embedded Python with libexpat
Change by Yilei Yang : -- keywords: +patch pull_requests: +29540 stage: -> patch review pull_request: https://github.com/python/cpython/pull/31397 ___ Python tracker <https://bugs.python.org/issue46784> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46803] Item not shown when using mouse wheel to scroll for Listbox/Combobox
New submission from Jason Yang : When scrolled items by mouse wheel in tk.Listbox/ttk.Combobox, some items not shown. Is it a bug ? or I did something wrong ? In following case, 'Wednesday' will not shown when scroll mouse wheel at - tk.Listbox or vertical scrollbar of tk.Listbox, or - listbox of ttk.Combo ```python from tkinter import * from tkinter import ttk font = ('Courier New', 24) lst = ('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday') root = Tk() frame1 = Frame(root) frame1.pack(side=LEFT) vsb1 = Scrollbar(frame1, orient='v') vsb1.pack(side=RIGHT, fill='y') var = StringVar() var.set(lst) listbox = Listbox(frame1, width=10, height=3, listvariable=var, font=font, yscrollcommand=vsb1.set) listbox.pack(side=LEFT) vsb1.configure(command=listbox.yview) frame2 = Frame(root) frame2.pack(side=LEFT, fill='y') combobox = ttk.Combobox(frame2, values=lst, width=10, height=3, font=font) combobox.pack() root.mainloop() ``` Platform: WIN10 -- components: Tkinter files: PeS9r.png messages: 413564 nosy: Jason990420 priority: normal severity: normal status: open title: Item not shown when using mouse wheel to scroll for Listbox/Combobox type: behavior versions: Python 3.8, Python 3.9 Added file: https://bugs.python.org/file50634/PeS9r.png ___ Python tracker <https://bugs.python.org/issue46803> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46825] slow matching on regular expression
New submission from Heran Yang : I'm using `re.fullmatch` to match a string that only contains 0 and 1. The regular expression is: (0+|1(01*0)*1)+ It runs rather slow with Python 3.7, but when I try using regex in C++, with std::regex_constants::__polynomial, it works well. Would someone take a look at it? Thx. -- components: Regular Expressions files: match.py messages: 413700 nosy: HeRaNO, ezio.melotti, mrabarnett priority: normal severity: normal status: open title: slow matching on regular expression type: performance versions: Python 3.7 Added file: https://bugs.python.org/file50636/match.py ___ Python tracker <https://bugs.python.org/issue46825> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46899] use of uninitialized value with msan from subprocess_fork_exec
New submission from Yilei Yang : The uid & gid variable from https://github.com/python/cpython/blob/9833bb91e4d5c2606421d9ec2085f5c2dfb6f72c/Modules/_posixsubprocess.c#L737-L738 can be passed to the `do_fork_exec` call below uninitialized and cause msan to report use-of-uninitialized-value errors. Those variables are guarded by call_setgid/call_setuid so they aren't really used uninitialized in practice. It would just be great if we can make it msan clean. Ideally, the long list of do_fork_exec arguments could also be rewritten in a struct. -- components: Library (Lib) messages: 414320 nosy: gregory.p.smith, yilei priority: normal severity: normal status: open title: use of uninitialized value with msan from subprocess_fork_exec type: enhancement versions: Python 3.10, Python 3.11, Python 3.9 ___ Python tracker <https://bugs.python.org/issue46899> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13542] Memory leak in multiprocessing.pool
New submission from Yang Zhang : Calling Pool.map (and friends) on empty lists [] causes Pool._cache to hang on to the MapResults forever: tp = ThreadPool(5) xs = tp.map(lambda x: 'a' * int(10e6), range(100)) # now using 1GB mem = 100 * 10MB strs del xs gc.collect() # still using 1GB mem tp.close(); tp.join() # now using ~0GB mem -- components: Library (Lib) messages: 148937 nosy: yang priority: normal severity: normal status: open title: Memory leak in multiprocessing.pool type: resource usage versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.4 ___ Python tracker <http://bugs.python.org/issue13542> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13542] Memory leak in multiprocessing.pool
Yang Zhang added the comment: Oops, sorry - pasted a wrong example. In [38]: tp = ThreadPool(5) In [39]: xs = tp.map(lambda x: x, []) In [40]: xs Out[40]: [] In [41]: tp._cache Out[41]: {3: } -- ___ Python tracker <http://bugs.python.org/issue13542> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11226] subprocesses experience mysterious delay in receiving stdin EOF
New submission from Yang Zhang : I'm seeing this issue on all the multiple Ubuntu 10.04 boxes I've tried. I reduced a problem I was seeing in my application down into the following test case. In this code, a parent process concurrently spawns 2 (you can spawn more) subprocesses that read a big message from the parent over stdin, sleep for 5 seconds, and write something back. However, there's unexpected waiting happening somewhere, causing the code to complete in 10 seconds instead of the expected 5. If you set verbose=True, you can see that the straggling subprocess is receiving most of the messages, then waiting for the last chunk of 3 chars---it's not detecting that the pipe has been closed. Furthermore, if I simply don't do anything with the second process (doreturn=True), the first process will never see the EOF. Further down is some example output. When trying this out, you may need to increase the message size to see the behavior occur. from subprocess import * from threading import * from time import * from traceback import * import sys verbose = False doreturn = False msg = (20*4096+3)*'a' def elapsed(): return '%7.3f' % (time() - start) if sys.argv[1:]: start = float(sys.argv[2]) if verbose: for chunk in iter(lambda: sys.stdin.read(4096), ''): print >> sys.stderr, '..', time(), sys.argv[1], 'read', len(chunk) else: sys.stdin.read() print >> sys.stderr, elapsed(), '..', sys.argv[1], 'done reading' sleep(5) print msg else: start = time() def go(i): print elapsed(), i, 'starting' p = Popen(['python','stuckproc.py',str(i), str(start)], stdin=PIPE, stdout=PIPE) if doreturn and i == 1: return print elapsed(), i, 'writing' p.stdin.write(msg) print elapsed(), i, 'closing' p.stdin.close() print elapsed(), i, 'reading' p.stdout.read() print elapsed(), i, 'done' ts = [Thread(target=go, args=(i,)) for i in xrange(2)] for t in ts: t.start() for t in ts: t.join() Example output: 0.001 0 starting 0.003 1 starting 0.005 0 writing 0.016 1 writing 0.093 0 closing 0.093 0 reading 0.094 1 closing 0.094 1 reading 0.098 .. 1 done reading 5.103 1 done 5.108 .. 0 done reading 10.113 0 done -- components: Library (Lib) messages: 128699 nosy: yaaang priority: normal severity: normal status: open title: subprocesses experience mysterious delay in receiving stdin EOF type: behavior versions: Python 2.6 ___ Python tracker <http://bugs.python.org/issue11226> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11226] subprocesses experience mysterious delay in receiving stdin EOF
Yang Zhang added the comment: After way too much time, I figured it out, after a quote from this post jumped out at me: See the "I/O on Pipes and FIFOs" section of pipe(7) ("man 7 pipe") "If all file descriptors referring to the write end of a pipe have been closed, then an attempt to read(2) from the pipe will see end-of- file (read(2) will return 0)." I should've known this, but it never occurred to me - had nothing to do with Python in particular. What was happening was: the subprocesses were getting forked with open (writer) file descriptors to each others' pipes. As long as there are open writer file descriptors to a pipe, readers won't see EOF. E.g.: p1=Popen(..., stdin=PIPE, ...) # creates a pipe the parent process can write to p2=Popen(...) # inherits the writer FD - as long as p2 exists, p1 won't see EOF Turns out there's a close_fds parameter to Popen, so the solution is to pass close_fds=True. All simple and obvious in hindsight, but still managed to cost at least a couple eyeballs good chunks of time. -- resolution: -> invalid status: open -> closed ___ Python tracker <http://bugs.python.org/issue11226> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3145] help> modules os raises UnicodeDecodeError
New submission from Michael Yang <[EMAIL PROTECTED]>: >>> help() help> modules os Here is a list of matching modules. Enter any module name to get more help. posix - This module provides access to operating system ... stringprep - Library that exposes various tables found in the StringPrep RFC 3454. Traceback (most recent call last): File "", line 1, in ... File "/home/michael/python3/3.0b1/lib/python3.0/codecs.py", line 300, in decode (result, consumed) = self._buffer_decode(data, self.errors, final) UnicodeDecodeError: 'utf8' codec can't decode bytes in position 8-11: invalid data -- components: Interpreter Core messages: 68419 nosy: msyang severity: normal status: open title: help> modules os raises UnicodeDecodeError type: behavior versions: Python 3.0 ___ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue3145> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3635] pickle.dumps cannot save instance of dict-derived class that overrides __getattribute__
New submission from Michael Yang <[EMAIL PROTECTED]>: # pickle.dumps is not able to process an instance of # a class that inherits from 'dict' and # overrides the built-in __getattribute__ method # but can successfully process one that # overrides the__getattr__ method >>> class Examp1(dict): ... def __getattr__(self,name): ... return self[name] ... >>> class Examp2(dict): ... def __getattribute__(self,name): ... return self[name] ... >>> ex1 = Examp1() >>> ex2 = Examp2() >>> ex1['aKey'] = (3,4) >>> ex2['aKey2'] = (4,5) >>> ex1 {'aKey': (3, 4)} >>> ex1.aKey (3, 4) >>> ex2 {'aKey2': (4, 5)} >>> ex2.aKey2 (4, 5) >>> import pickle >>> pickle.dumps(ex1) b'\x80\x03c__main__\nexamp1\nq\x00)\x81q\x01X\x04\x00\x00\x00aKeyq\x02K\x03K\x04\x86q\x03s}q\x04b.' >>> pickle.dumps(ex2) Traceback (most recent call last): File "", line 1, in File "[hidden]/python3/3.0b2/common/lib/python3.0/pickle.py", line 1319, in dumps Pickler(f, protocol).dump(obj) File "", line 3, in __getattribute__ KeyError: '__reduce_ex__' -- components: Extension Modules messages: 71671 nosy: msyang severity: normal status: open title: pickle.dumps cannot save instance of dict-derived class that overrides __getattribute__ type: behavior versions: Python 2.5, Python 3.0 ___ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue3635> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3709] BaseHTTPRequestHandler innefficient when sending HTTP header
New submission from Yang Zhao <[EMAIL PROTECTED]>: send_header() in BaseHTTPRequestHandler currently does a write to socket every time send_header() is called. This results in excessive number of TCP packets being regenerated. Ideally, as much of the HTTP packet is buffered as possible, but, at minimum, the header should be sent with a single write as there is a convenient end_header() functional available. Behaviour is observed under python 2.5, but the related code looks identical in SVN trunk. Will contribute patch if request is deemed reasonable but no one is available to work on it; I just need a few days. -- components: Library (Lib) messages: 72051 nosy: yangman severity: normal status: open title: BaseHTTPRequestHandler innefficient when sending HTTP header type: performance versions: Python 2.5 ___ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue3709> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8161] inconsistency behavior in ctypes.c_char_p dereferencing
New submission from Jackson Yang : # Python 3.1.2rc1 (r312rc1:78742, Mar 7 2010, 07:49:40) # [MSC v.1500 32 bit (Intel)] on win32 import ctypes class T(ctypes.Structure): _fields_ = ( ('member', ctypes.c_char * 16), ) # dereference a c_char_Array variable would return print('%r'%((ctypes.c_char * 16)()[:])) # dereference from a c_char_Array member would return , which is buggy print('%r'%(T().member[:])) -- assignee: theller components: ctypes messages: 101214 nosy: nullnil, theller severity: normal status: open title: inconsistency behavior in ctypes.c_char_p dereferencing type: behavior versions: Python 3.2 ___ Python tracker <http://bugs.python.org/issue8161> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4584] doctest fails to display bytes type
New submission from Michael Yang <[EMAIL PROTECTED]>: doctest.testmod() fails when attempting to echo back a bytes type with ord() > 128. def ok(): """ >>> bytes([255,]) b'\xff' """ pass def notOK(): """ >>> b'\xff' """ pass import doctest doctest.testmod() Traceback (most recent call last): ... UnicodeEncodeError: 'ascii' codec can't encode character '\xff' in position 141: ordinal not in range(128) -- components: Extension Modules messages: 77264 nosy: msyang severity: normal status: open title: doctest fails to display bytes type type: behavior versions: Python 3.0 ___ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue4584> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4886] test/regrtest.py contains error on __import__
New submission from Michael Yang : I want to use the included test.regrtest (located in $pythondir/lib/python[ver]/test) to regression test some of my own scripts located in directory myDir. The script has some nice configurability features to skip some tests based on machine configurations, etc. that a vanilla unittest suite doesn't include automatically. However, it seems that the script regrtest.py has an error following the __import__ line. Here's my setup: /sample.py /myDir /__init__.py /test_file1.py /test_file2.py /... in sample.py: {{{ #!python #!/usr/bin/env python import test.regrtest as rt rt.main(tests = ['myDir.test_file1','myDir.test_file2'], \ quiet = False, verbose = True) }}} running sample.py yields: {{{ #!sh myDir.test_file1 myDir.test_file1 skipped -- No module named myDir.test_file1 myDir.test_file2 myDir.test_file2 skipped -- No module named myDir.test_file2 2 tests skipped: myDir.test_file1 myDir.test_file2 2 skips unexpected on win32: myDir.test_file1 myDir.test_file2 }}} This is due to the code snippet in regrtest.py around line 554: {{{ #!python ... if test.startswith('test.'): abstest = test else: # Always import it from the test package abstest = 'test.' + test the_package = __import__(abstest, globals(), locals(), []) the_module = getattr(the_package, test) ... }}} should be changed to: {{{ #!python ... if test.startswith('test.'): abstest = test modName = test[len('test.'):] else: # Always import it from the test package abstest = 'test.' + test modName = test the_package = __import__(abstest, globals(), locals(), []) the_module = getattr(the_package, modName) ... }}} This way, the the_module will correctly find the module name in 'the_package'. A further recommendation: the main() module should be able to work with test directories with name other than 'test.*'. Otherwise, users wishing to use the main() on other directories will have to name them 'test.' Depending on the user's directory's position in sys.path (before or after $pythondir/lib/python[ver]), regrtest.main() will either fail due to the 'from test import ...' statements being shadowed by the user's 'test' directory or the user's 'test' directory being shadowed by the standard library's. -- components: Library (Lib) messages: 79442 nosy: msyang severity: normal status: open title: test/regrtest.py contains error on __import__ versions: Python 2.6, Python 3.0 ___ Python tracker <http://bugs.python.org/issue4886> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4886] test/regrtest.py contains error on __import__
Changes by Michael Yang : -- type: -> behavior ___ Python tracker <http://bugs.python.org/issue4886> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue37846] declare that Text I/O use buffer inside
New submission from Windson Yang : At the beginning of https://docs.python.org/3.7/library/io.html#io.RawIOBase, we declared that > Binary I/O (also called buffered I/O) and > Raw I/O (also called unbuffered I/O) But we didn't mention if Text I/O use buffer or not which led to confusion. Even though we talked about it later in https://docs.python.org/3.7/library/io.html#class-hierarchy > The TextIOBase ABC, another subclass of IOBase, deals with streams whose > bytes represent text, and handles encoding and decoding to and from strings. > TextIOWrapper, which extends it, is a buffered text interface to a buffered > raw stream (BufferedIOBase). Finally, StringIO is an in-memory stream for > text. IMO, it will be better to declare 'Reads and writes are internally buffered in order to speed things up' at the very beginning in > Text I/O > Text I/O expects and produces str objects... or maybe > class io.TextIOBase > Base class for text streams. This class provides a character and line based > interface to stream I/O. It inherits IOBase. There is no public constructor. -- assignee: docs@python components: Documentation messages: 349633 nosy: Windson Yang, docs@python priority: normal severity: normal status: open title: declare that Text I/O use buffer inside type: enhancement versions: Python 3.8 ___ Python tracker <https://bugs.python.org/issue37846> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue37846] declare that Text I/O use buffer inside
Windson Yang added the comment: I found the document is not that clear when I try to understand what happens when Python read/write a file. I'm not sure who also needs this information. As you said, It wouldn't help the user program in Python. However, make it more clear maybe help users have a better feeling of what is happening under the hood. -- ___ Python tracker <https://bugs.python.org/issue37846> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38125] Can' build document in Sphinx v2.2.0
New submission from Windson Yang : I got two errors when I try to build python document with make venv make html The first one is > Since v2.0, Sphinx uses "index" as master_doc by default. Please add > "master_doc = 'contents'" to your conf.py. After fixing this one, the second one is > /Users/windson/learn/cpython/Doc/library/email.message.rst:4:duplicate object > description of email.message, other instance in > library/email.compat32-message, use :noindex: for one of them -- assignee: docs@python components: Documentation messages: 352034 nosy: Windson Yang, docs@python priority: normal severity: normal status: open title: Can' build document in Sphinx v2.2.0 type: crash versions: Python 3.9 ___ Python tracker <https://bugs.python.org/issue38125> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38125] Can' build document in Sphinx v2.2.0
Change by Windson Yang : -- stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue38125> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38626] small change at bisect_left function for easy understanding
New submission from Windson Yang : bisect_left should be similar to bisect_right. However, the current implement didn't reflect it. A little bit update for the bisect_left function could make the user easy to understand their relation. def bisect_left(a, x, lo=0, hi=None): if lo < 0: raise ValueError('lo must be non-negative') if hi is None: hi = len(a) while lo < hi: mid = (lo+hi)//2 # <= should be the only difference between bisect_left and bisect_right if x <= a[mid]: hi = mid else: lo = mid+1 return lo -- components: Library (Lib) messages: 355606 nosy: Windson Yang priority: normal severity: normal status: open title: small change at bisect_left function for easy understanding versions: Python 3.8 ___ Python tracker <https://bugs.python.org/issue38626> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43628] Incorrect argument errors for random.getstate()
New submission from Yang Feng : In documentation of random.getstate(), it says: “random.getstate() Return an object capturing the current internal state of the generator. This object can be passed to setstate() to restore the state.” random.getstate() takes 0 argument and return the current setting for the weekday to start each week. However, when I give one argument to random.getstate(), the interpreter reports the following error: -- >>> import random >>> random.getstate(1) Traceback (most recent call last): File "", line 1, in TypeError: getstate() takes 1 positional argument but 2 were given -- Here I have two doubts about the reported errors: 1. Is the TypeError correct? This should be an inconsistent argument number error. There is nothing to do with Type. 2. Is the detailed error correct? Doc says random.getstate() takes 0 argument, the reported error says getstate() take 1 positional argument. which is inconsistent. Besides, I pass one argument to random.getstate(), but the reported error says 2 were given. Environment: Python 3.10, Ubuntu 16.04 -- assignee: docs@python components: Documentation messages: 389535 nosy: CharlesFengY, docs@python priority: normal severity: normal status: open title: Incorrect argument errors for random.getstate() versions: Python 3.10 ___ Python tracker <https://bugs.python.org/issue43628> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43940] int casting to float results to a different value in memory
New submission from Huang Yang : from ctypes import * import struct i = int('7f94e57c', 16) cp = pointer(c_int(i)) fp = cast(cp, POINTER(c_float)) print(fp.contents.value) # nan print(struct.pack(">f", fp.contents.value).hex()) # 7fd4e57c # value changed: 7f94e57c -> 7fd4e57c -- components: Library (Lib), ctypes messages: 391876 nosy: yang8621 priority: normal severity: normal status: open title: int casting to float results to a different value in memory type: behavior versions: Python 3.8 ___ Python tracker <https://bugs.python.org/issue43940> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43940] int casting to float results to a different value in memory
Huang Yang added the comment: It's reproducible only if the float is nan, with prefix 7f or ff. Seems the value is OR operated by 0x0040. -- ___ Python tracker <https://bugs.python.org/issue43940> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43940] int casting to float results to a different value in memory
Huang Yang added the comment: Also reproducible by: from ctypes import * i = int('7f94e57c', 16) cp = pointer(c_int(i)) fp = cast(cp, POINTER(c_float)) print(fp.contents.value) # nan p = pointer(c_float(fp.contents.value)) ip = cast(p, POINTER(c_int)) print(hex(ip.contents.value)) #'0x7fd4e57c' -- ___ Python tracker <https://bugs.python.org/issue43940> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43940] int casting to float results to a different value in memory
Huang Yang added the comment: OK. Seems it's the default behavior of CPU instruction. And CPU follows the IEEE standard of float. Is there any workaround? -- status: pending -> open ___ Python tracker <https://bugs.python.org/issue43940> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12458] Tracebacks should contain the first line of continuation lines
Edward Yang added the comment: Supposing I like the old behavior (line number of the end of the statement), is there any way to recover that line number from the traceback after this change? -- nosy: +ezyang ___ Python tracker <https://bugs.python.org/issue12458> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue45210] tp_dealloc docs should mention error indicator may be set
New submission from Edward Yang : The fact that the error indicator may be set during tp_dealloc is somewhat well known (https://github.com/posborne/dbus-python/blob/fef4bccfc535c6c2819e3f15384600d7bc198bc5/_dbus_bindings/conn.c#L387) but it's not documented in the official manual. We should document it. A simple suggested patch: diff --git a/Doc/c-api/typeobj.rst b/Doc/c-api/typeobj.rst index b17fb22b69..e7c9b13646 100644 --- a/Doc/c-api/typeobj.rst +++ b/Doc/c-api/typeobj.rst @@ -668,6 +668,20 @@ and :c:type:`PyType_Type` effectively act as defaults.) :c:func:`PyObject_GC_Del` if the instance was allocated using :c:func:`PyObject_GC_New` or :c:func:`PyObject_GC_NewVar`. + If you may call functions that may set the error indicator, you must + use :c:func:`PyErr_Fetch` and :c:func:`PyErr_Restore` to ensure you + don't clobber a preexisting error indicator (the deallocation could + have occurred while processing a different error): + + .. code-block:: c + + static void foo_dealloc(foo_object *self) { + PyObject *et, *ev, *etb; + PyErr_Fetch(&et, &ev, &etb); + ... + PyErr_Restore(et, ev, etb); + } + Finally, if the type is heap allocated (:const:`Py_TPFLAGS_HEAPTYPE`), the deallocator should decrement the reference count for its type object after calling the type deallocator. In order to avoid dangling pointers, the -- assignee: docs@python components: Documentation messages: 401854 nosy: docs@python, ezyang priority: normal severity: normal status: open title: tp_dealloc docs should mention error indicator may be set type: enhancement versions: Python 3.11 ___ Python tracker <https://bugs.python.org/issue45210> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20092] type() constructor should bind __int__ to __index__ when __index__ is defined and __int__ is not
Patrick Yang added the comment: I ended up in this issue after I learnt the following from the Python Library Reference Manual. float(..). For a general Python object x, float(x) delegates to x.__float__(). If __float__() is not defined then it falls back to __index__(). The discussion on __int__() and __index__() was very interesting but I still didn't get the answer I wanted. If __int__() is assumed to be a possibly approximate conversion and it's possible that __int__() may exist while __index__() doesn't, shouldn't __int__() be used as a fall back before __index__()? The downside would be that the resulting float may not be "very close" to the original object because __int__() is only an approximation while __index__() guarantees exact, but loss of precision is acceptable during type conversion, isn't it? (i.e. int(3.14) -> 3). Perhaps it's not acceptable if the conversion is a widening conversion and that's why __int__() is skipped? -- nosy: +patrick.yang.1248 ___ Python tracker <https://bugs.python.org/issue20092> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue36093] UnicodeEncodeError raise from smtplib.verify() method
Windson Yang added the comment: Any update? -- ___ Python tracker <https://bugs.python.org/issue36093> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue36453] pkgutil.get_importer only return the first valid path_hook(importer)
Windson Yang added the comment: Any update? -- ___ Python tracker <https://bugs.python.org/issue36453> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43185] AssertRaises() causes core dump in handling recursion
New submission from Yang Feng : Seeing the following program, in the second assertRaises(), function "test_invalid_adpcm_state()" is recursively called. Then a fatal Python error shows up and the Python interpreter crashes. ++ import unittest import audioop class TestAudioop(unittest.TestCase): pass def test_invalid_adpcm_state(): TestAudioop.assertRaises(TypeError, audioop.lin2adpcm, b'\x00', 1, 555) TestAudioop.assertRaises(test_invalid_adpcm_state(), audioop.adpcm2lin, b'\x00', 1, (0, (- 1))) TestAudioop = TestAudioop() test_invalid_adpcm_state() +++ System Info: Ubuntu 16.04 Python Version: Python 3.9.1 -- components: Library (Lib) messages: 386763 nosy: CharlesFengY priority: normal severity: normal status: open title: AssertRaises() causes core dump in handling recursion type: crash versions: Python 3.9 ___ Python tracker <https://bugs.python.org/issue43185> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43186] Recursive call causes core dump in assertRaises
New submission from Yang Feng : In following teststr.py, class MyString is nestedly instanced in method __getattr__(). This script will lead to a "core dump" in Python interpreter. My Python version is 3.9.1 and my operating system is Ubuntu 16.04. teststr.py +++ class StrError(str): pass class MyString: def __init__(self, istr): self.__mystr__ = istr def __getattr__(self, content): with self: return MyString(getattr(self.__mystr__, content)) def __setattr__(self, content, sstr): setattr(self.__mystr__, content) def __enter__(self): return self def __exit__(self, exc_type, exc_val, exc_tb): raise StrError(self.__mystr__) return True MyString("hello") + -- components: Library (Lib) messages: 386764 nosy: CharlesFengY priority: normal severity: normal status: open title: Recursive call causes core dump in assertRaises versions: Python 3.9 ___ Python tracker <https://bugs.python.org/issue43186> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43187] Dict creation in recursive function cause interpreter crashes.
New submission from Yang Feng : In the following programs, dict is created in recursive calls. Then a core dump is reported by Python interpreter. +++ def test_equal_operator_modifying_operand(): class X(): def __del__(DictTest): dict_b.clear() def __eq__(DictTest, other): dict_a.clear() return True def __hash__(DictTest): return 13 dict_d = {X(): 0} class Y(): def __eq__(DictTest, other): dict_d.clear() return True dict_d = {0: Y()} # dict_c = {0: set()} test_equal_operator_modifying_operand() test_equal_operator_modifying_operand() + -- components: Interpreter Core messages: 386765 nosy: CharlesFengY priority: normal severity: normal status: open title: Dict creation in recursive function cause interpreter crashes. type: crash versions: Python 3.9 ___ Python tracker <https://bugs.python.org/issue43187> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43188] multiple operations of dict causes core dump of Python interpreter.
New submission from Yang Feng : In the following programs, we call check_reentrant_insertion("s") twice, after multiple of update and clear of dict, the Python interpreter crashes. +++ def check_reentrant_insertion(mutate): class Mutating: def __del__(self): mutate(d) d = {k: Mutating() for k in 'abcdefghijklmnopqr'} for k in list(d): d[k] = k def test_reentrant_insertion(): check_reentrant_insertion("s") def mutate(d): d.update(DictTest.__dict__) d.clear() check_reentrant_insertion(test_reentrant_insertion()) test_reentrant_insertion() + System Info: Ubuntu 16.04 Python Version: Python 3.9.1 -- components: Interpreter Core messages: 386766 nosy: CharlesFengY priority: normal severity: normal status: open title: multiple operations of dict causes core dump of Python interpreter. type: crash versions: Python 3.9 ___ Python tracker <https://bugs.python.org/issue43188> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43189] decorator function run_with_locale() crashes Python interpreter
New submission from Yang Feng : We use run_with_locale() as decorator function, then we recursively call test_float__format__locale in the following example. Python interpreter crashes. +++ from test.support import run_with_locale @run_with_locale('LC_NUMERIC', 'en_US.UTF8') def test_float__format__locale(): test_float__format__locale() test_float__format__locale() + System Info: Ubuntu 16.04 Python Version: Python 3.9.1 -- components: Tests messages: 386767 nosy: CharlesFengY priority: normal severity: normal status: open title: decorator function run_with_locale() crashes Python interpreter type: crash versions: Python 3.9 ___ Python tracker <https://bugs.python.org/issue43189> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43190] < test.support > check_free_after_iterating( ) causes core dump in handling iteration.
New submission from Yang Feng : In the following program, we call check_free_after_iterating( ) twice, in the second time, we recursively call function test_free_after_iterating(). Python interpreter crashes. +++ import unittest import test.support class UnicodeTest(unittest.TestCase): pass def test_free_after_iterating(): ut = UnicodeTest() test.support.check_free_after_iterating(ut, iter, str) test.support.check_free_after_iterating(str, test_free_after_iterating(), str) test_free_after_iterating() + System Info: Ubuntu 16.04 Python Version: Python 3.9.1 -- components: Library (Lib) messages: 386768 nosy: CharlesFengY priority: normal severity: normal status: open title: < test.support > check_free_after_iterating( ) causes core dump in handling iteration. type: crash versions: Python 3.9 ___ Python tracker <https://bugs.python.org/issue43190> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43185] AssertRaises() causes core dump in handling recursion
Yang Feng added the comment: Could you please tell me your secret method of getting the minimal script? I will try to provide minimal ones in our following work. -- ___ Python tracker <https://bugs.python.org/issue43185> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35228] Index search in CHM help crashes viewer
Keelung Yang added the comment: It's reoccurable in Python 3.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:37:02) [MSC v.1924 64 bit (AMD64)] on windows version 10.0.19041.264 Just need to open "Python 3.8 Manuals (64-bit)" --> index --> input 'p' on keyboard. -- nosy: +Keelung Yang ___ Python tracker <https://bugs.python.org/issue35228> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40897] Inheriting from Generic causes inspect.signature to always return (*args, **kwargs) for constructor (and all subclasses)
New submission from Edward Yang : Consider the following program: ``` import inspect from typing import Generic, TypeVar T = TypeVar('T') class A(Generic[T]): def __init__(self) -> None: pass print(inspect.signature(A)) ``` I expect inspect.signature to return () as the signature of the constructor of this function. However, I get this: ``` $ python3 foo.py (*args, **kwds) ``` Although it is true that one cannot generally rely on inspect.signature to always give the most accurate signature (because there may always be decorator or metaclass shenanigans getting in the way), in this particular case it seems especially undesirable because Python type annotations are supposed to be erased at runtime, and yet here inheriting from Generic (simply to add type annotations) causes a very clear change in runtime behavior. -- components: Library (Lib) messages: 370870 nosy: ezyang priority: normal severity: normal status: open title: Inheriting from Generic causes inspect.signature to always return (*args, **kwargs) for constructor (and all subclasses) type: behavior versions: Python 3.9 ___ Python tracker <https://bugs.python.org/issue40897> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue41105] Add some extra content check in configure process for some empty header file who has been deprecated by glibc
Change by Jiachen Yang : -- nosy: +Jiachen Yang ___ Python tracker <https://bugs.python.org/issue41105> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35286] wrong result for difflib.SequenceMatcher
Change by Boris Yang : -- stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue35286> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue42186] unittest overrides more serious warnings filter added before unittest.main()
New submission from Yilei Yang : Because unittest adds a `default` filter before tests run, other warnings filters are overridden if added before. Ideally, unittest should not make the warnings less serious, e.g. if there is already an 'error' filter that raises exception, it shouldn't "downgrade" to 'default' that simply prints. The following example, using lib.a_function() raises exception in a regular program, but the unit test passes: $ cat lib.py import warnings class MyWarning(UserWarning): pass warnings.filterwarnings('error', category=MyWarning) def a_function(): warnings.warn('Do not use.', MyWarning) $ cat lib_test.py import unittest import lib class TestLib(unittest.TestCase): def test_function(self): lib.a_function() if __name__ == '__main__': unittest.main() $ python -m unittest -v lib_test test_function (lib_test.TestLib) ... lib.py:6: MyWarning: Do not use. warnings.warn('Do not use.', MyWarning) ok -- Ran 1 test in 0.000s OK $ python >>> import lib >>> lib.a_function() Traceback (most recent call last): File "", line 1, in File "lib.py", line 6, in a_function warnings.warn('Do not use.', MyWarning) lib.MyWarning: Do not use. -- components: Library (Lib) messages: 379843 nosy: yilei priority: normal severity: normal status: open title: unittest overrides more serious warnings filter added before unittest.main() type: behavior versions: Python 3.10, Python 3.6, Python 3.7, Python 3.8, Python 3.9 ___ Python tracker <https://bugs.python.org/issue42186> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14068] problem with re split
harvey yang added the comment: i am not use it to split whitespace or newline. i use it to split Chinese full stop. and the result is showed at the earlier message. -- ___ Python tracker <http://bugs.python.org/issue14068> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14068] problem with re split
harvey yang added the comment: i see. thanks :) -- ___ Python tracker <http://bugs.python.org/issue14068> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14416] syslog missing constants
New submission from Edward Yang : The syslog module is missing constants for a number of logging priorities available on modern Linuxen. In particular, the following options are missing: LOG_ODELAY, LOG_AUTHPRIV, LOG_SYSLOG, LOG_UUCP. -- components: Library (Lib) messages: 156842 nosy: ezyang priority: normal severity: normal status: open title: syslog missing constants type: enhancement versions: Python 2.7 ___ Python tracker <http://bugs.python.org/issue14416> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14416] syslog missing constants
Edward Yang added the comment: I misspoke about UUCP. SYSLOG appears to be missing from the documentation. Arguably they should be present if Linux supports them, and missing if they don't (same as LOG_PERROR, and some of the other constants.) Then you can do feature detection Python-side. -- ___ Python tracker <http://bugs.python.org/issue14416> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14531] Backtrace should not attempt to open file
New submission from Edward Yang : When generating a backtrace from an interactive Python session (e.g. the input is from , Python attempts to actually find a file named , to somewhat hilarious consequences. See the strace'd Python session below: >>> foo open("/etc/default/apport", O_RDONLY|O_LARGEFILE) = 3 Traceback (most recent call last): File "", line 1, in open("", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) open("", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) open("/usr/local/lib/python2.7/dist-packages/pylint-0.24.0-py2.7.egg/", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) open("/usr/local/lib/python2.7/dist-packages/logilab_astng-0.22.0-py2.7.egg/", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) open("/usr/local/lib/python2.7/dist-packages/logilab_common-0.56.1-py2.7.egg/", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) open("/usr/local/lib/python2.7/dist-packages/unittest2-0.5.1-py2.7.egg/", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) open("/usr/local/lib/python2.7/dist-packages/GitPython-0.3.2.RC1-py2.7.egg/", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) open("/usr/local/lib/python2.7/dist-packages/gitdb-0.5.4-py2.7-linux-i686.egg/", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) open("/usr/local/lib/python2.7/dist-packages/smmap-0.8.1-py2.7.egg/", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) open("/usr/local/lib/python2.7/dist-packages/async-0.6.1-py2.7-linux-i686.egg/", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) open("/usr/local/lib/python2.7/dist-packages/decorator-3.3.1-py2.7.egg/", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) open("/usr/local/lib/python2.7/dist-packages/SQLAlchemy-0.7.2-py2.7-linux-i686.egg/", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) open("/usr/local/lib/python2.7/dist-packages/Sphinx-1.0.7-py2.7.egg/", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) open("/usr/local/lib/python2.7/dist-packages/docutils-0.8.1-py2.7.egg/", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) open("/usr/local/lib/python2.7/dist-packages/Jinja2-2.6-py2.7.egg/", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) open("/usr/local/lib/python2.7/dist-packages/Pygments-1.4-py2.7.egg/", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) open("/usr/local/lib/python2.7/dist-packages/nose-1.1.2-py2.7.egg/", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) open("/home/ezyang/Dev/6.02/", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) open("/home/ezyang/Dev/pyafs/", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) open("/home/ezyang/Dev/wizard/", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) open("/home/ezyang/Dev/twisted/", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) open("/usr/local/lib/python2.6/site-packages/", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) open("/home/ezyang/Work/shared-python/build/lib.linux-i686-2.6/", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) open("/home/ezyang/Work/snarfs/python/coil/", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) open("/home/ezyang/Dev/py-github/src/", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) open("/usr/lib/python2.7/", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) open("/usr/lib/python2.7/plat-linux2/", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) open("/usr/lib/python2.7/lib-tk/", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) open("/usr/lib/python2.7/lib-old/", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) open("/usr/lib/python2.7/lib-dynload/", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) open("/usr/local/lib/python2.7/dist-packages/", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) open("/usr/lib/python2.7/dist-packages/", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) open("/usr/lib/python2.7/dist-packages/Numeric/", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) open("/usr/lib/python2.7/dist-packages/PIL/", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) open("/usr/lib/python2.7/dist-packages/gst-0.10/", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) open("/usr/lib/python2.7/dist-packages/gtk-2.0/", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) open("/
[issue14531] Backtrace should not attempt to open file
Edward Yang added the comment: "" is a valid name of a file on Unix systems. So the fix is not so clear. ezyang@javelin:~$ python Python 2.7.2+ (default, Oct 4 2011, 20:03:08) [GCC 4.6.1] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> a Traceback (most recent call last): File "", line 1, in Here’s an idea: when a (multi-variable) calculus course arrives at the topic of the *chain rule*, it should use as a worked example the multilayer perceptron—a topic you usually only find in an introductory artificial intelligence course. In fact, it’s ideal, since the treatment of this topic in most AI courses (at this point, I’ve taken two—a byproduct of slightly mismatched class schedules when you study abroad) involves *no* extra theoretical computer science content whatsoever. If you know the definition of a multilayer perceptron, any Calculus student who knows the chain rule should be able to work out the back-propagation algorithm—or perhaps I should call it a *recurrence.* NameError: name 'a' is not defined -- ___ Python tracker <http://bugs.python.org/issue14531> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue36411] Python 3 f.tell() gets out of sync with file pointer in binary append+read mode
Windson Yang added the comment: I'm not sure it's a bug. When you write binary data to file (use BufferedIOBase by default). It actually writes the data to a buffer. That is why tell() gets out of sync. You can follow the instrument belolw. For instance, call flush() after writing to get the `correct answer.` > When writing to this object, data is normally placed into an internal buffer. > The buffer will be written out to the underlying RawIOBase object under > various conditions, including: > when the buffer gets too small for all pending data; > when flush() is called; > when a seek() is requested (for BufferedRandom objects); > when the BufferedWriter object is closed or destroyed. 1. https://docs.python.org/3/library/io.html#io.BufferedWriter -- ___ Python tracker <https://bugs.python.org/issue36411> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue36411] Python 3 f.tell() gets out of sync with file pointer in binary append+read mode
Windson Yang added the comment: I think we should mention it at the document, like in the tell() function. -- ___ Python tracker <https://bugs.python.org/issue36411> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue37073] clarify functions docs in IO modules and Bytes Objects
New submission from Windson Yang : > PyBytes_FromStringAndSize(const char *v, Py_ssize_t len): > Return a new bytes object with a copy of the string v as value and length len > on success, and NULL on failure. If v is NULL, the contents of the bytes > object are uninitialized. The function actually copies `len` bytes from string v instead of the whole string. (link 1) I suggested we can change to > Return a new bytes object with a copy of the first len bytes of string v as > value and length len on success... > readinto(b) > Read bytes into a pre-allocated, writable bytes-like object b and return the > number of bytes read. For example, b might be a bytearray. The function will call _bufferediobase_readinto_generic(link 2) which may return NULL. Maybe we can change to > and return the number of bytes that read succeed (it may be smaller than b or > NULL if failed)... 1. https://github.com/python/cpython/blob/master/Objects/bytesobject.c#L126 2. https://github.com/python/cpython/blob/master/Modules/_io/bufferedio.c#L962 -- assignee: docs@python components: Documentation messages: 343741 nosy: Windson Yang, docs@python priority: normal severity: normal status: open title: clarify functions docs in IO modules and Bytes Objects type: enhancement versions: Python 3.8 ___ Python tracker <https://bugs.python.org/issue37073> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue37079] PEM cadata causes ssl.SSLError: nested ans1 error
Change by Jizhou Yang : -- assignee: christian.heimes components: SSL nosy: Jizhou Yang, christian.heimes priority: normal severity: normal status: open title: PEM cadata causes ssl.SSLError: nested ans1 error type: crash versions: Python 2.7 ___ Python tracker <https://bugs.python.org/issue37079> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue37079] PEM cadata causes ssl.SSLError: nested asn1 error
New submission from Jizhou Yang : Loading cadata in PEM format results in a nested asn1 error. Workaround is to convert cadata to unicode. Minimum code for reproducing the issue: >>>import ssl >>> with open('ca.crt') as f: ... ca_crt = f.read() ... >>> c = ssl.create_default_context() >>> c.load_verify_locations(cadata=ca_crt) Traceback (most recent call last): File "", line 1, in ssl.SSLError: nested asn1 error (_ssl.c:2902) With workaround to make it work: >>>import ssl >>> with open('ca.crt') as f: ... ca_crt = f.read() ... >>> c = ssl.create_default_context() >>> c.load_verify_locations(cadata=unicode(ca_crt)) The issue is annoying as the documentation explicitly states cadata to be "either an ASCII string of one or more PEM-encoded certificates...". Furthermore the unicode function is not present in Python 3.x, making the workaround version-dependent. -- title: PEM cadata causes ssl.SSLError: nested ans1 error -> PEM cadata causes ssl.SSLError: nested asn1 error Added file: https://bugs.python.org/file48373/ca.crt ___ Python tracker <https://bugs.python.org/issue37079> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue37079] PEM cadata causes ssl.SSLError: nested asn1 error
Jizhou Yang added the comment: Thanks a lot for the quick answer! Verified that the proposed solution works with PEM certificates in both Python 2 and 3. -- stage: -> resolved status: pending -> closed ___ Python tracker <https://bugs.python.org/issue37079> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue37073] clarify functions docs in IO modules and Bytes Objects
Windson Yang added the comment: Sure. Feel free to edit my PR. -- ___ Python tracker <https://bugs.python.org/issue37073> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue37073] clarify functions docs in IO modules and Bytes Objects
Change by Windson Yang : -- keywords: +patch pull_requests: +13600 stage: -> patch review pull_request: https://github.com/python/cpython/pull/13713 ___ Python tracker <https://bugs.python.org/issue37073> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue37073] clarify functions docs in IO modules and Bytes Objects
Change by Windson Yang : -- pull_requests: +13602 pull_request: https://github.com/python/cpython/pull/13715 ___ Python tracker <https://bugs.python.org/issue37073> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26468] shutil.copy2 raises OSError if filesystem doesn't support chmod
Change by Windson Yang : -- keywords: +patch pull_requests: +13651 stage: -> patch review pull_request: https://github.com/python/cpython/pull/13765 ___ Python tracker <https://bugs.python.org/issue26468> ___ ___ 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
Windson Yang added the comment: I just create a PR for it. -- nosy: +Windson Yang ___ 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
Change by Windson Yang : -- keywords: +patch pull_requests: +13652 stage: -> patch review pull_request: https://github.com/python/cpython/pull/13768 ___ 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
[issue15474] Differentiate decorator and decorator factory in docs
Windson Yang added the comment: Hi, Andrés Delfino. Are you still working on it? -- nosy: +Windson Yang ___ Python tracker <https://bugs.python.org/issue15474> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue29750] smtplib doesn't handle unicode passwords
Windson Yang added the comment: Sorry, I forgot about this PR, I will update the patch depends on review soon :D -- ___ Python tracker <https://bugs.python.org/issue29750> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue29750] smtplib doesn't handle unicode passwords
Change by Windson Yang : -- pull_requests: +14813 pull_request: https://github.com/python/cpython/pull/15064 ___ Python tracker <https://bugs.python.org/issue29750> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue29750] smtplib doesn't handle unicode passwords
Windson Yang added the comment: I just updated the PR -- ___ Python tracker <https://bugs.python.org/issue29750> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30763] There is functionality bug in linecache library.
New submission from Yang Xiao: There is a functionality bug in linecache library. >>test.py<< import linecache def test_getline(f): print linecache.getlines(f) if __name__ == "__main__": tf1 = 'aaa' with open(tf1,'w') as f: f.write('good morning\n') test_getline(tf1) tf2 = 'bbb' with open(tf2,'w') as f: f.write('good evening\n') test_getline(tf2) tf1 = 'aaa' with open(tf1,'w') as f: f.write('good morning 123\n') test_getline(tf1) tf2 = 'bbb' with open(tf2,'w') as f: f.write('good evening 123\n') test_getline(tf2) The expectant output shoule be: ['good morning\n'] ['good evening\n'] ['good morning\n'] ['good evening\n'] However, the script above outputs below: ['good morning\n'] ['good evening\n'] ['good morning\n'] ['good evening\n'] I think there is a bug about implementation of linecache library. -- components: 2to3 (2.x to 3.x conversion tool) messages: 296874 nosy: Yang Xiao priority: normal severity: normal status: open title: There is functionality bug in linecache library. type: behavior versions: Python 2.7 ___ Python tracker <http://bugs.python.org/issue30763> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30763] There is functionality bug in linecache library.
Yang Xiao added the comment: Sorry, there is a mistake in msg296874. The expectant output shoule be: ['good morning\n'] ['good evening\n'] ['good morning 123\n'] ['good evening 123\n'] -- ___ Python tracker <http://bugs.python.org/issue30763> ___ ___ 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
Change by Windson Yang : -- assignee: -> docs@python components: +Documentation -Library (Lib) nosy: +docs@python ___ 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
[issue35273] 'eval' in generator expression behave different in dict from list
Windson Yang added the comment: I get NameError for both versions in both 3.4.4, 3.5.2, 3.6.4, 3.7.1 -- nosy: +Windson Yang ___ Python tracker <https://bugs.python.org/issue35273> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35289] wrong result for difflib.SequenceMatcher
New submission from Boris Yang : How to repeat: # -*- coding: UTF-8 -*- from difflib import SequenceMatcher seqMatcher = SequenceMatcher(None, "德阳孩子", "孩子德阳") seqMatcher.get_matching_blocks() Expect Result: [Match(a=0, b=3, size=2), Match(a=2, b=0, size=2), Match(a=5, b=5, size=0)] Current Result: [Match(a=0, b=3, size=2), Match(a=5, b=5, size=0)] -- messages: 330175 nosy: Boris Yang priority: normal severity: normal status: open title: wrong result for difflib.SequenceMatcher type: behavior versions: Python 3.7 ___ Python tracker <https://bugs.python.org/issue35289> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35288] wrong result for difflib.SequenceMatcher
Change by Boris Yang : -- stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue35288> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35289] wrong result for difflib.SequenceMatcher
Change by Boris Yang : -- stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue35289> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35287] wrong result for difflib.SequenceMatcher
Change by Boris Yang : -- stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue35287> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35131] Cannot access to customized paths within .pth file
Windson Yang added the comment: I will fix this issue after we have consensus with the future of .pth file in #33944 -- ___ Python tracker <https://bugs.python.org/issue35131> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35267] reproducible deadlock with multiprocessing.Pool
Windson Yang added the comment: I will work on it if no one wants to create a PR for this next week. -- ___ Python tracker <https://bugs.python.org/issue35267> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35348] Problems with handling the file command output in platform.architecture()
Windson Yang added the comment: I agreed with Serhiy. I also found the function decode the output with latin-1, I think it will be better to use utf-8 instead. -- nosy: +Windson Yang ___ Python tracker <https://bugs.python.org/issue35348> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35325] imp.find_module() return value documentation discrepancy
Windson Yang added the comment: If I understand correctly, this may be better. Try to find the module name. If path is omitted or None, the list of directory names given by sys.path is searched. If path is built-in or frozen modules, return None instead. BTW, the dosstring should also be updated, I will not continue search the path if the path in build-in or frozen. and this module is deprecated since version 3.4 -- nosy: +Windson Yang versions: +Python 3.4, Python 3.5, Python 3.6 ___ Python tracker <https://bugs.python.org/issue35325> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com