[issue27635] pickle documentation says that unpickling may not call __new__
New submission from July Tikhonov: A note just below object.__setstate__() documentation https://docs.python.org/3.6/library/pickle.html#object.__setstate__ says that """ … the type should implement __getnewargs__() or __getnewargs_ex__() to establish such an invariant; otherwise, neither __new__() nor __init__() will be called. """ I believe that note about not calling __new__() was relevant in python2. I could not find case in python3 in which __new__() would not be called. And __init__() is not called anyway, as far as I understand (unless explicitly by __setstate__() or something). Python 3.6.0a3+ (default:da9898e7e90d, Jul 27 2016, 19:51:12) [GCC 4.9.3] on linux Type "help", "copyright", "credits" or "license" for more information. >>> class C: ... def __getstate__(self): return {'foo' : self.foo} ... def __setstate__(self, state): self.foo = state['foo'] ... def __new__(cls): ... print('__new__ is called'); return super().__new__(cls) ... def __init__(self): ... print('__init__ is called'); self.foo = None; super().__init__() ... >>> c = C(); c.foo = 'bar' __new__ is called __init__ is called >>> import pickle >>> c2 = pickle.loads(pickle.dumps(c)) __new__ is called >>> c2.foo 'bar' -- assignee: docs@python components: Documentation messages: 271465 nosy: docs@python, july priority: normal severity: normal status: open title: pickle documentation says that unpickling may not call __new__ versions: Python 3.4, Python 3.5, Python 3.6 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue27635> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24351] string.Template documentation incorrectly references identifiers
New submission from July Tikhonov: Documentation of Template says: $identifier names a substitution placeholder matching a mapping key of identifier. By default, identifier must spell a Python identifier. The first non-identifier character after the $ character terminates this placeholder specification. While it was true when these lines were written, Python 3 has greatly extended identifier character set, and it no longer matches the set of characters used by Template: Template('$foo123щъ').substitute(foo=1, foo123=2, foo123щъ=3) '2щъ' I propose clarifying documentation. Actually extending character set is backward-incompatible, although it won't be if restricted to ${identifier} syntax. -- assignee: docs@python components: Documentation messages: 244607 nosy: docs@python, july priority: normal severity: normal status: open title: string.Template documentation incorrectly references identifiers versions: Python 3.4, Python 3.5, Python 3.6 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24351 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24314] irrelevant cross-link in documentation of user-defined functions
New submission from July Tikhonov: https://docs.python.org/3/reference/datamodel.html#the-standard-type-hierarchy There is a table of special attributes of user-defined functions. The __name__ attribute name is a link, but it leads to something quite irrelevant: the description of __name__ attribute of imported modules. In Doc/reference/datamodel.rst, there is nothing special about __name__ attribute, so it looks like some random spasm of Sphinx creating links here and there. My knowledge of rst is not sufficient to suppress it. -- assignee: docs@python components: Documentation messages: 244301 nosy: docs@python, july priority: normal severity: normal status: open title: irrelevant cross-link in documentation of user-defined functions type: behavior versions: Python 3.4, Python 3.5, Python 3.6 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24314 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24110] zipfile.ZipFile.write() does not accept bytes arcname
New submission from July Tikhonov: In documentation of zipfile.ZipFile.write() there is following notice: There is no official file name encoding for ZIP files. If you have unicode file names, you must convert them to byte strings in your desired encoding before passing them to write(). I understand it as that 'arcname' argument to write() shouldn't be of type str, but rather bytes. But it is str that works, and bytes that does not: $ ./python Python 3.5.0a4+ (default:6f6e78931875, May 1 2015, 23:18:40) [GCC 4.8.4] on linux Type help, copyright, credits or license for more information. import zipfile zf = zipfile.ZipFile('foo.zip', 'w') zf.write('python', 'a') zf.write('python', b'b') Traceback (most recent call last): File stdin, line 1, in module File /home/july/source/python/Lib/zipfile.py, line 1442, in write zinfo = ZipInfo(arcname, date_time) File /home/july/source/python/Lib/zipfile.py, line 322, in __init__ null_byte = filename.find(chr(0)) TypeError: a bytes-like object is required, not 'str' (ZipInfo ostensibly attempts to find a zero byte in the filename, but searches instead for a unicode character chr(0). There are several other places in ZipInfo class that assume filename being str rather than bytes.) I consider this a documentation issue: the notice is misleading. Although maybe there is someone who wants to fix the behavior of ZipInfo to allow bytes filename. -- assignee: docs@python components: Documentation messages: 242355 nosy: docs@python, july priority: normal severity: normal status: open title: zipfile.ZipFile.write() does not accept bytes arcname type: behavior versions: Python 3.4, Python 3.5, Python 3.6 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24110 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24110] zipfile.ZipFile.write() does not accept bytes arcname
Changes by July Tikhonov july.t...@gmail.com: -- components: +Library (Lib) ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24110 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24062] links to os.stat() in documentation lead to stat module instead
New submission from July Tikhonov: Documentation of os.fstat() https://docs.python.org/3/library/os.html#os.fstat has a See also: section, which features a wrong link. The same with os.lstat(). Some of this problem was fixed (among other things) in issue 10960. But since then, two more wrong links appeared. Attached patch applies to 3.5, although 3.4 has the same problem. -- assignee: docs@python components: Documentation files: doc-library-os-stat-links.diff keywords: patch messages: 242070 nosy: docs@python, july priority: normal severity: normal status: open title: links to os.stat() in documentation lead to stat module instead type: enhancement versions: Python 3.4, Python 3.5, Python 3.6 Added file: http://bugs.python.org/file39209/doc-library-os-stat-links.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24062 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19717] resolve() fails when the path doesn't exist
Changes by July Tikhonov july.t...@gmail.com: -- nosy: +july ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19717 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20639] pathlib.PurePath.with_suffix() does not allow removing the suffix
July Tikhonov added the comment: Proposed patch attached. -- Added file: http://bugs.python.org/file34100/pathlib-with_suffix.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20639 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20639] pathlib.PurePath.with_suffix() does not allow removing the suffix
New submission from July Tikhonov: The changeset ef2b2ddd27c8 restricted the argument of Path.with_suffix() too much, and caused some strange behavior. Case 1: removing suffix completely is disallowed now. The following code worked before the fix: pathlib.PurePath('a', 'b.c').with_suffix('') PurePosixPath('a/b') but now fails with ValueError: pathlib.PurePath('a', 'b.c').with_suffix('') Traceback (most recent call last): File stdin, line 1, in module File /home/july/source/python/Lib/pathlib.py, line 760, in with_suffix raise ValueError(Invalid suffix %r % (suffix)) ValueError: Invalid suffix '' It was the only one obvious way of removing the suffix, and I think it should remain so. (BTW: There is a XXX note in the code questioning if Path.with_suffix(None) should remove the suffix.) Case 2: while the output is now always a correct Path, the suffix can still contain separator. The following code produced incorrect path before the fix: pathlib.PurePath('a', 'b.c').with_suffix('./.s/.') PurePosixPath('a/b./.s/.') _.parts ('a', 'b./.s/.') Now, the produced path is correct, but the code itself is still allowed: pathlib.PurePath('a', 'b.c').with_suffix('./.s/.') PurePosixPath('a/b.s') while I would expect it to fail with ValueError. Attached: proposed test patch. -- components: Library (Lib) files: pathlib-with_suffix-test.diff keywords: patch messages: 211316 nosy: july, pitrou priority: normal severity: normal status: open title: pathlib.PurePath.with_suffix() does not allow removing the suffix type: behavior versions: Python 3.4, Python 3.5 Added file: http://bugs.python.org/file34099/pathlib-with_suffix-test.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20639 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20111] pathlib.PurePath.with_suffix() allows creation of otherwise impossible paths
New submission from July Tikhonov: This is not a real-world example, but it brokes some invariant (part of path must not contain separator): pathlib.PurePath('/a/b.c.d').with_suffix('///') PurePosixPath('/a/b.c///') pathlib.PurePath('/a/b.c.d').with_suffix('/not/split/into/parts').parts ('/', 'a', 'b.c/not/split/into/parts') I think these cases should raise an error. I would also like to consider the following to be an error, since the argument of with_suffix() is not exactly a suffix: PurePath('/a/b.c.d').with_suffix('e') PurePosixPath('/a/b.ce') but I'm far less sure in this case. -- components: Library (Lib) messages: 207185 nosy: july, pitrou priority: normal severity: normal status: open title: pathlib.PurePath.with_suffix() allows creation of otherwise impossible paths versions: Python 3.4, Python 3.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20111 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20111] pathlib.PurePath.with_suffix() allows creation of otherwise impossible paths
Changes by July Tikhonov july.t...@gmail.com: -- type: - behavior ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20111 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18820] json.dump() ignores its 'default' option when serializing dictionary keys
New submission from July Tikhonov: According to documentation of json.dump(), concerning its 'default' option: default(obj) is a function that should return a serializable version of obj or raise TypeError. The default simply raises TypeError. But this function is actually never applied to serialized dictionary keys: def default(obj): ... if isinstance(obj, bytes): ... return obj.decode('ascii') ... raise ValueError ... json.dumps(b'asdf') Traceback (most recent call last): ... TypeError: b'asdf' is not JSON serializable json.dumps(b'asdf', default=default) 'asdf' json.dumps({b'asdf' : 1}, default=default) Traceback (most recent call last): ... TypeError: keys must be a string json.dumps({1 : b'asdf'}, default=default) '{1: asdf}' (bytes are used purely for the purpose of example) Such behavior should be either documented or corrected. Patch correcting python implementation of json attached. -- assignee: docs@python components: Documentation, Library (Lib) files: json-default-dict-keys.diff keywords: patch messages: 195957 nosy: docs@python, july priority: normal severity: normal status: open title: json.dump() ignores its 'default' option when serializing dictionary keys type: enhancement versions: Python 3.4 Added file: http://bugs.python.org/file31436/json-default-dict-keys.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18820 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18820] json.dump() ignores its 'default' option when serializing dictionary keys
July Tikhonov added the comment: Oops, my patch disables 'skipkeys' argument of dump. Another version attached. -- Added file: http://bugs.python.org/file31437/json-default-dict-keys.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18820 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18820] json.dump() ignores its 'default' option when serializing dictionary keys
Changes by July Tikhonov july.t...@gmail.com: Removed file: http://bugs.python.org/file31436/json-default-dict-keys.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18820 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18820] json.dump() ignores its 'default' option when serializing dictionary keys
July Tikhonov added the comment: Proposed tests attached. -- Added file: http://bugs.python.org/file31450/json-default-tests.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18820 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17215] documentation misprints
New submission from July Tikhonov: library/io.rst io.open() signature lacks 'opener' argument. library/importlib.rst concreate - concrete -- assignee: docs@python components: Documentation files: docs-misprint.diff keywords: patch messages: 182219 nosy: docs@python, july priority: normal severity: normal status: open title: documentation misprints type: behavior versions: Python 3.3, Python 3.4 Added file: http://bugs.python.org/file29086/docs-misprint.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17215 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13904] Generator as *args: TypeError replaced
New submission from July Tikhonov july.t...@gmail.com: set().union(*(None[k] for k in range(5))) Traceback (most recent call last): File stdin, line 1, in module TypeError: union() argument after * must be a sequence, not generator Clearly, exception in not relevant, since next line works: set().union(*([k] for k in range(5))) {0, 1, 2, 3, 4} Correct exception would be None[1] Traceback (most recent call last): File stdin, line 1, in module TypeError: 'NoneType' object is not subscriptable Problem is in python function call mechanics. set().union can be replaced by any callable; Generator can be replaced by any TypeError-raising iterable. Exceptions other then TypeError are handled correctly. Python/ceval.c:4322 ext_do_call() converts stararg to tuple. If any TypeError is raised, it is replaced with TypeError(%s argument after * must be a sequence, not %s) Proposed solution: Probably, we can avoid replacing TypeError. Exceptions in the above cases would become relevant, and int(*None) Traceback (most recent call last): File stdin, line 1, in module TypeError: type object argument after * must be a sequence, not NoneType would become int(*None) Traceback (most recent call last): File stdin, line 1, in module TypeError: 'NoneType' object is not iterable so exception is still recognizable (and, may be, even more relevant, since we don't actually need _sequence_ as stararg, _iterable_ would be enough). -- components: Interpreter Core files: typeerror-replaced-in-stararg.diff keywords: patch messages: 152243 nosy: july priority: normal severity: normal status: open title: Generator as *args: TypeError replaced type: behavior versions: Python 3.3 Added file: http://bugs.python.org/file24358/typeerror-replaced-in-stararg.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13904 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13904] Generator as *args: TypeError replaced
Changes by July Tikhonov july.t...@gmail.com: Added file: http://bugs.python.org/file24359/typeerror-replaced-in-stararg-test.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13904 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13835] whatsnew/3.3 misspelling/mislink
New submission from July Tikhonov july.t...@gmail.com: 1) Paragraph describing range() comparison links to issue13021. This issue seems unrelated. It should be issue13201. 2) Paragraph describing of unicode_internal codec, mentions (utf-16-le or utf-16-le) and (utf-32-le or utf-32-le). It should be (utf-16-le or utf-16-be) and (utf-32-le or utf-32-be) respectively. -- assignee: docs@python components: Documentation files: whatsnew-3.3-misspelling.diff keywords: patch messages: 151765 nosy: docs@python, july priority: normal severity: normal status: open title: whatsnew/3.3 misspelling/mislink versions: Python 3.3 Added file: http://bugs.python.org/file24291/whatsnew-3.3-misspelling.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13835 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12959] Add 'ChainMap' to collections.__all__
New submission from July Tikhonov july.t...@gmail.com: ChainMap is the only item from collections module, that is described in docs, but is not included in collections.__all__ -- components: Library (Lib) files: chainmap_in___all__.diff keywords: patch messages: 143862 nosy: july priority: normal severity: normal status: open title: Add 'ChainMap' to collections.__all__ type: feature request versions: Python 3.3, Python 3.4 Added file: http://bugs.python.org/file23128/chainmap_in___all__.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12959 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12547] whatsnew/3.3: error in example about nntplib
July Tikhonov july.t...@gmail.com added the comment: The very same example (with the same error) can be found in Doc/library/nntplib.rst -- resolution: fixed - status: closed - open Added file: http://bugs.python.org/file22758/library.nntplib.rst.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12547 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12547] whatsnew/3.3: error in example about nntplib
New submission from July Tikhonov july.t...@gmail.com: from nntplib import NNTP with nntplib.NNTP('news.gmane.org') as n: will not work. It should be import nntplib with nntplib.NNTP('news.gmane.org') as n: or from nntplib import NNTP with NNTP('news.gmane.org') as n: -- assignee: docs@python components: Documentation files: whatsnew.3.3.nntplib.example.diff keywords: patch messages: 140228 nosy: docs@python, july priority: normal severity: normal status: open title: whatsnew/3.3: error in example about nntplib type: behavior versions: Python 3.3 Added file: http://bugs.python.org/file22638/whatsnew.3.3.nntplib.example.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12547 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11441] compile() raises SystemError if called from except clause
July Tikhonov july.t...@gmail.com added the comment: There is an XXX just before the definition of ast_error. Wouldn't it be useful? The idea is to merge ast_error() and ast_error_finish(). This requires redefinition of most functions in ast.c, adding const char *filename to their parameters. -- Added file: http://bugs.python.org/file21061/unnamed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11441 ___There is an XXX just before the definition of ast_error. Wouldn#39;t it be useful?divbr/divdivThe idea is to merge ast_error() and ast_error_finish().br clear=allThis requires redefinition of most functions in ast.c, adding quot;const char *filenamequot; to their parameters./div ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11441] compile() raises SystemError if called from except clause
Changes by July Tikhonov july.t...@gmail.com: Removed file: http://bugs.python.org/file21061/unnamed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11441 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11441] compile() raises SystemError if called from except clause
New submission from July Tikhonov july.t...@gmail.com: Normal: compile('1 = 1', 'string', 'exec') Traceback (most recent call last): File stdin, line 1, in module File string, line 1 SyntaxError: can't assign to literal SystemError is raised instead of SyntaxError: try: abcde ... except NameError: ... compile('1 = 1', 'string', 'exec') ... Traceback (most recent call last): File stdin, line 1, in module NameError: name 'abcde' is not defined During handling of the above exception, another exception occurred: Traceback (most recent call last): File stdin, line 3, in module SystemError: Objects/tupleobject.c:126: bad argument to internal function Error can be discovered by calling dis.dis('1 = 1'). -- components: Library (Lib) messages: 130342 nosy: july priority: normal severity: normal status: open title: compile() raises SystemError if called from except clause type: behavior versions: Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11441 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11208] example misprint in documentation whatsnew/3.2
New submission from July Tikhonov july.t...@gmail.com: list(accumulate(8, 2, 50)) fails. Correct version is list(accumulate([8, 2, 50])) -- assignee: docs@python components: Documentation files: whatsnew.3.2.accumulate.example.diff keywords: patch messages: 128529 nosy: docs@python, july priority: normal severity: normal status: open title: example misprint in documentation whatsnew/3.2 versions: Python 3.2, Python 3.3 Added file: http://bugs.python.org/file20757/whatsnew.3.2.accumulate.example.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11208 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11132] compileall.compile_dir loses 'optimize' parameter in recursion.
New submission from July Tikhonov july.t...@gmail.com: july@julynote:~/test ls -R .: c.py subdir ./subdir: a.py b.py july@julynote:~/test python3 Python 3.2rc2+ (py3k, Feb 6 2011, 13:06:04) [GCC 4.5.0 20100604 [gcc-4_5-branch revision 160292]] on linux2 Type help, copyright, credits or license for more information. from compileall import compile_dir compile_dir('.', optimize=1) Listing . ... Compiling ./c.py ... Listing ./subdir ... Compiling ./subdir/a.py ... Compiling ./subdir/b.py ... 1 july@julynote:~/test ls -R .: c.py __pycache__ subdir ./__pycache__: c.cpython-32.pyo ./subdir: a.py b.py __pycache__ ./subdir/__pycache__: a.cpython-32.pyc b.cpython-32.pyc july@julynote:~/test It seems that the bug was introduced in svn revision 87019 (Add an optimize parameter to compile() to control the optimization level, and provide an interface to it in py_compile, compileall and PyZipFile.). In recursion, 'optimize' parameter is lost and replaced by default -1 (optimize level of the interpreter). Test patch added. -- components: Library (Lib) files: compileall.compile_dir.optimize.test.diff keywords: patch messages: 128048 nosy: july priority: normal severity: normal status: open title: compileall.compile_dir loses 'optimize' parameter in recursion. type: behavior versions: Python 3.2 Added file: http://bugs.python.org/file20696/compileall.compile_dir.optimize.test.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11132 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11132] compileall.compile_dir loses 'optimize' parameter in recursion.
July Tikhonov july.t...@gmail.com added the comment: Patch added. -- Added file: http://bugs.python.org/file20697/compileall.compile_dir.optimize.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11132 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6771] Curses.wrapper: documentation/implementation error
July Tikhonov july.t...@gmail.com added the comment: I think, since curses.wrapper is actually a function (and module named curses.wrapper cannot be trivially accessed), we can just modify docs, stripping out any mentions of module, instead documenting the function. We can leave the module 'curses.wrapper' and line 'from curses.wrapper import wrapper' in its current state, as implementation detail. Also, this is not backward incompatible in any case. Patch added. -- keywords: +patch nosy: +july Added file: http://bugs.python.org/file17505/curses-wrapper-doc.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6771 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8861] curses.wrapper : unnessesary code
New submission from July Tikhonov july.t...@gmail.com: wrapper() code in Lib/curses/wrapper.py has an unnesesary line: res = None This variable is not used anywhere else in wrapper(). Inspecting the history of trunk, we can see that it was used used as a result of applying func(), but later was replaced by another construction. Patch added. -- components: Library (Lib) files: curses-wrapper-cleanup.patch keywords: patch messages: 106798 nosy: july priority: normal severity: normal status: open title: curses.wrapper : unnessesary code versions: Python 2.7, Python 3.2, Python 3.3 Added file: http://bugs.python.org/file17506/curses-wrapper-cleanup.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8861 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8862] curses.wrapper does not restore terminal if curses.getkey() gets KeyboardInterrupt
New submission from July Tikhonov july.t...@gmail.com: Run test.py (below) in terminal, and interrupt it with Ctrl-C. Result: terminal settings are not restored (checked with linux console and xterm, with Python 2.7 and 3.2). # test.py # Broke it with KeyboardInterrupt import curses def main(screen): k = screen.getkey() curses.wrapper(main) # Results are hardly readable due to the broken terminal. # Something about KeyboardInterrupt However, if getkey() is surrounded by try-except, behavior changes: # test2.py # Broke it with KeyboardInterrupt import curses def main2(screen): try: k = screen.getkey() except KeyboardInterrupt: raise curses.wrapper(main2) # Terminal is restored to its normal state. In python3.2 test2.py results in traceback: Traceback (most recent call last): File test2.py, line 4, in main2 k = screen.getkey() _curses.error: no input During handling of the above exception, another exception occurred: Traceback (most recent call last): File test2.py, line 7, in module curses.wrapper(main2) File /usr/local/lib/python3.2/curses/wrapper.py, line 44, in wrapper return func(stdscr, *args, **kwds) File test2.py, line 4, in main2 k = screen.getkey() KeyboardInterrupt In 2.7 it results only in the latest part of traceback: Traceback (most recent call last): File test2.py, line 7, in module curses.wrapper(main2) File /usr/local/lib/python2.7/curses/wrapper.py, line 44, in wrapper return func(stdscr, *args, **kwds) File test2.py, line 4, in main2 k = screen.getkey() KeyboardInterrupt The problem is that instead of a single KeyboardInterrupt, two exceptions are raised: KeyboardInterrupt and _curses.error('no input'). Possible solution is to suppress _curses.error in this case (since it is less relevant than KeyboardInterrupt, IMO). -- components: Library (Lib) messages: 106799 nosy: july priority: normal severity: normal status: open title: curses.wrapper does not restore terminal if curses.getkey() gets KeyboardInterrupt type: behavior versions: Python 2.7, Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8862 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3445] Ignore missing attributes in functools.update_wrapper
July Tikhonov july.t...@gmail.com added the comment: To Evan Klitzke (eklitzke): I'm also interested in seeing this fixed. In the current behavior, the following code doesn't work: start code from functools import wraps def magic(func): @wraps(func) def even_more_magic(*args): return func(*args) return even_more_magic class Frob(object): @magic @classmethod def hello(cls): print '%r says hello' % (cls,) end code This code _should not_ work. [Unbound] classmethod object is not a method or a function, it is even not a callable; it is a descriptor (returning callable). So, it cannot be wrapped or decorated in such way. If you want something like this to work, you probably should place @classmethod on the upper level (in other words, apply classmethod after all other decorators): @classmethod @magic def hello(cls): print '%r says hello' % (cls,) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3445 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3445] Ignore missing attributes in functools.update_wrapper
July Tikhonov july.t...@gmail.com added the comment: Patch updated: bound and unbound methods, user-defined callable, partial object included in test. By the way, [id(abs.__doc__) for i in range(5)] [140714383081744, 140714383081744, 140714383081744, 140714383081744, 140714383081744] [id(s) for s in [abs.__doc__ for i in range(5)]] [140714383084040, 140714383082976, 140714383083144, 140714383075904, 140714383081744] How it can be explained? Built-in functions (and methods) _sometimes_ return a new instance of its '__doc__' (and '__name__'), and sometimes does not. (I found this trying to include built-in method into the test.) -- nosy: +july Added file: http://bugs.python.org/file17184/update_wrapper-ignore-missing-attributes.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3445 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7775] str.rpartition(sep) - (tail, sep, head)
July Tikhonov july.t...@gmail.com added the comment: Not only str, but also bytearray, unicode, and bytes. -- keywords: +patch nosy: +july Added file: http://bugs.python.org/file15998/rpartition-docstrings-trunk.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7775 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7775] str.rpartition(sep) - (tail, sep, head)
Changes by July Tikhonov july.t...@gmail.com: Added file: http://bugs.python.org/file15999/rpartition-docstrings-py3k.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7775 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7765] 'unittest' documentation misprints
New submission from July Tikhonov july.t...@gmail.com: Errors in command line examples. One missed space (only in py3k version), and one not so obvious misprint (in both py3k and trunk). -- assignee: georg.brandl components: Documentation files: unittest-doc-py3k.diff keywords: patch messages: 98196 nosy: georg.brandl, july severity: normal status: open title: 'unittest' documentation misprints versions: Python 2.7, Python 3.2 Added file: http://bugs.python.org/file15980/unittest-doc-py3k.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7765 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7765] 'unittest' documentation misprints
Changes by July Tikhonov july.t...@gmail.com: Added file: http://bugs.python.org/file15981/unittest-doc-trunk.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7765 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7762] (C API) PyUnicode_Tailmatch documentation
New submission from July Tikhonov july.t...@gmail.com: It mentions Return value: New reference., but I have no idea of what it can mean in this function, since the return type is 'int'. http://docs.python.org/dev/py3k/c-api/unicode.html#PyUnicode_Tailmatch -- assignee: georg.brandl components: Documentation messages: 98176 nosy: georg.brandl, july severity: normal status: open title: (C API) PyUnicode_Tailmatch documentation versions: Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7762 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7763] (C API) PyUnicode_Tailmatch documentation
New submission from July Tikhonov july.t...@gmail.com: It mentions Return value: New reference., but I have no idea of what it can mean in this function, since the return type is 'int'. http://docs.python.org/dev/py3k/c-api/unicode.html#PyUnicode_Tailmatch -- assignee: georg.brandl components: Documentation messages: 98177 nosy: georg.brandl, july severity: normal status: open title: (C API) PyUnicode_Tailmatch documentation versions: Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7763 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7683] Wrong link in HTML documentation
July Tikhonov july.t...@gmail.com added the comment: I don't see anything wrong in this fact.. All what's new pages since python 2.0 are keeped in documentation, not only the last one. -- nosy: +july ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7683 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7620] Vim syntax highlight
New submission from July Tikhonov july.t...@gmail.com: 'python.vim' syntax rules script was created for python 2 (automatically, using script 'vim_python.py'). This patch updates it to run by python 3. Some bugs with highlighting strings and numbers are resolved, too. Also, 'syntax_test.py' is updated; relatively extensive tests on numbers, strings and statements added. -- components: Demos and Tools files: vimsyntax.diff keywords: patch messages: 97134 nosy: July severity: normal status: open title: Vim syntax highlight type: feature request versions: 3rd party Added file: http://bugs.python.org/file15719/vimsyntax.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7620 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7618] optparse library documentation has an insignificant formatting issue
July Tikhonov july.t...@gmail.com added the comment: Also, I found 4 similar problems in this text (seach 'usage:' to find them). These are resolved in this patch. -- keywords: +patch nosy: +July Added file: http://bugs.python.org/file15720/doc-library-optparse.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7618 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7620] Vim syntax highlight
July Tikhonov july.t...@gmail.com added the comment: Reuploaded (some syntax groups fixed). -- Added file: http://bugs.python.org/file15721/misc-vim-syntax.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7620 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7620] Vim syntax highlight
Changes by July Tikhonov july.t...@gmail.com: Removed file: http://bugs.python.org/file15719/vimsyntax.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7620 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7590] 'exceptions' module mentioned in documentation
New submission from July Tikhonov july.t...@gmail.com: As I can see, 'exceptions' module does not exist in py3k. But it is mentioned in documentation http://docs.python.org/dev/py3k/library/exceptions.html The exceptions are defined in the module exceptions. This module never needs to be imported explicitly: the exceptions are provided in the built-in namespace as well as the exceptions module. -- assignee: georg.brandl components: Documentation messages: 96965 nosy: July, georg.brandl severity: normal status: open title: 'exceptions' module mentioned in documentation type: behavior versions: 3rd party ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7590 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6477] Pickling of NoneType raises PicklingError
July Tikhonov july.t...@gmail.com added the comment: No, my program failed on this. It was not a big problem to manage this, but I think it is a bug. And it isn't documented (or I can't find it). Other built-in types have no such problem. Is there something special with NoneType? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6477 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6477] Pickling of NoneType raises PicklingError
New submission from July Tikhonov july.t...@gmail.com: Python 3.2a0 (py3k:73749M, Jul 1 2009, 23:17:59) [GCC 4.3.2 [gcc-4_3-branch revision 141291]] on linux2 Type help, copyright, credits or license for more information. import pickle [40072 refs] pickle.dumps(type(None)) Traceback (most recent call last): File stdin, line 1, in module File /usr/local/lib/python3.2/pickle.py, line 1358, in dumps Pickler(f, protocol, fix_imports=fix_imports).dump(obj) _pickle.PicklingError: Can't pickle class 'NoneType': attribute lookup builtins.NoneType failed [40137 refs] -- components: Library (Lib) messages: 90496 nosy: July severity: normal status: open title: Pickling of NoneType raises PicklingError type: behavior versions: Python 2.6, Python 2.7, Python 3.0, Python 3.1, Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6477 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com