[issue8743] set() operators don't work with collections.Set instances
Nick Coghlan added the comment: I updated the patch to apply cleanly to the default branch. I also added several new test cases which uncovered issues with Daniel's previous patch. Specifically: - the reverse functions were not be tested properly (added a separate test to ensure they all return NotImplemented when appropriate) - the checks in the in-place operands were not being tested, and were also too strict (added tests for their input checking, and also ensured they still accepted arbitrary iterables as input) I've also reduced the target versions to just 3.4 - this will require a porting note in the What's New, since the inappropriate handling of arbitrary iterables in the ABC methods has been removed, which means that things that previously worked when they shouldn't (like accepting a list as the RHS of a binary set operator) will now throw TypeError. Python 3.3: set() | list() Traceback (most recent call last): File stdin, line 1, in module TypeError: unsupported operand type(s) for |: 'set' and 'list' from test.test_collections import WithSet WithSet() | list() test.test_collections.WithSet object at 0x7f71ff2f6210 After applying the attached patch: set() | list() Traceback (most recent call last): File stdin, line 1, in module TypeError: unsupported operand type(s) for |: 'set' and 'list' from test.test_collections import WithSet WithSet() | list() Traceback (most recent call last): File stdin, line 1, in module TypeError: unsupported operand type(s) for |: 'WithSet' and 'list' -- versions: -Python 2.7, Python 3.2, Python 3.3 Added file: http://bugs.python.org/file33863/issue8743-set-ABC-interoperability.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8743 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2226] Small _abcoll Bugs / Oddities
Nick Coghlan added the comment: With the only remaining issue here being the misbehaviour of the Set and MutableSet ABCs when dealing with other types (the other issues in Armin's original report were much simpler and fixed promptly), I'm closing this as a duplicate of issue 8743 (where I just uploaded an up to date patch based on the patch Daniel linked to above) -- resolution: - duplicate status: open - closed superseder: - set() operators don't work with collections.Set instances ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2226 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20475] pystone.py in 3.4 still uses time.clock(), even though it's marked as deprecated since 3.3
STINNER Victor added the comment: time.monotonic() has a bad resolution (15.6 ms) on Windows. To measure performances, use time.perf_counter() or time.process_time() as proposed in tome.clock() documentation. It depends if you want to include time elapsed during sleep. Usually time.perf_counter() is the expected function. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20475 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20480] Add ipaddress property to get name of reverse DNS PTR record
Eric V. Smith added the comment: I'd prefer to leave the trailing dots. It's the technically correct thing to do. And as they say, technically correct is the best kind of correct! -- title: Add ipaddress property to get name of reverse DNS pointer - Add ipaddress property to get name of reverse DNS PTR record ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20480 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8743] set() operators don't work with collections.Set instances
Nick Coghlan added the comment: I initially missed Mark's suggestion above to avoid the recursive subtraction operation in __rsub__. v2 of my patch includes that tweak. -- Added file: http://bugs.python.org/file33864/issue8743-set-ABC-interoperability_v2.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8743 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20480] Add ipaddress property to get name of reverse DNS PTR record
Eric V. Smith added the comment: The patch looks good to me, save for a versionadded tag in the docs. I've mentioned it on Rietveld. Not to get in to bikeshedding on the name, but I'd prefer something with PTR in the name. I'm an old-timer, and think of these as PTR lookups (because they are!). If I were looking for it, that's what I'd search for. And if not in the property name, then at least the documentation should mention it. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20480 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20480] Add ipaddress property to get name of reverse DNS PTR record
Eric V. Smith added the comment: Or, now that I think about it some more, maybe leave the name as reverse_pointer and just mention PTR records in the documentation. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20480 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20387] tokenize/untokenize roundtrip fails with tabs
Terry J. Reedy added the comment: I read the manual more carefully and noticed that the guarantee is that tokenizing the result of untokenize matches the input to untokenize. The result is guaranteed to tokenize back to match the input so that the conversion is lossless and round-trips are assured. I ran the test in 3.4 and noticed the exactness and direction of the matching does not matter because only the 2nd \t is replaced by a space, making the invalid code that raises IndentationError. So this is definitely a bug and I withdraw the close suggestion. I believe the test should be that both lines of the body begin with the same indent. from tokenize import tokenize, untokenize import io def test_tab_indent(self): code = bif False:\n\tx=3\n\ty=3\n codelines = untokenize(tokenize(io.BytesIO(s).readline)).split(\n) assertEqual(codelines[1], codelines[2]) Of course, the test of tokenize and untokenize should be separated. -- stage: - needs patch versions: +Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20387 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20387] tokenize/untokenize roundtrip fails with tabs
Terry J. Reedy added the comment: I think the problem is with untokenize. s =bif False:\n\tx=3\n\ty=3\n t = tokenize(io.BytesIO(s).readline) for i in t: print(i) produces a token stream that seems correct. TokenInfo(type=56 (ENCODING), string='utf-8', start=(0, 0), end=(0, 0), line='') TokenInfo(type=1 (NAME), string='if', start=(1, 0), end=(1, 2), line='if False:\n') TokenInfo(type=1 (NAME), string='False', start=(1, 3), end=(1, 8), line='if False:\n') TokenInfo(type=52 (OP), string=':', start=(1, 8), end=(1, 9), line='if False:\n') TokenInfo(type=4 (NEWLINE), string='\n', start=(1, 9), end=(1, 10), line='if False:\n') TokenInfo(type=5 (INDENT), string='\t', start=(2, 0), end=(2, 1), line='\tx=3\n') TokenInfo(type=1 (NAME), string='x', start=(2, 1), end=(2, 2), line='\tx=3\n') TokenInfo(type=52 (OP), string='=', start=(2, 2), end=(2, 3), line='\tx=3\n') TokenInfo(type=2 (NUMBER), string='3', start=(2, 3), end=(2, 4), line='\tx=3\n') TokenInfo(type=4 (NEWLINE), string='\n', start=(2, 4), end=(2, 5), line='\tx=3\n') TokenInfo(type=1 (NAME), string='y', start=(3, 1), end=(3, 2), line='\ty=3\n') TokenInfo(type=52 (OP), string='=', start=(3, 2), end=(3, 3), line='\ty=3\n') TokenInfo(type=2 (NUMBER), string='3', start=(3, 3), end=(3, 4), line='\ty=3\n') TokenInfo(type=4 (NEWLINE), string='\n', start=(3, 4), end=(3, 5), line='\ty=3\n') TokenInfo(type=6 (DEDENT), string='', start=(4, 0), end=(4, 0), line='') TokenInfo(type=0 (ENDMARKER), string='', start=(4, 0), end=(4, 0), line='') The problem with untokenize and indents is this: In the old untokenize duples function, now called 'compat', INDENT strings were added to a list and popped by the corresponding DEDENT. While compat has the minor problem of returning a string instead of bytes (which is actually as I think it should be) and adding extraneous spaces within and at the end of lines, it correctly handles tabs in your example and this: s =bif False:\n\tx=1\n\t\ty=2\n\t\t\tz=3\n t = tokenize(io.BytesIO(s).readline) print(untokenize(i[:2] for i in t).encode()) b'if False :\n\tx =1 \n\t\ty =2 \n\t\t\tz =3 \n' When tokenize was changed to producing 5-tuples, untokenize was changed to use the start and end coordinates, but all special processing of indents was cut in favor of .add_space(). So this issue is a regression due in inadequate testing. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20387 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17159] Remove explicit type check from inspect.Signature.from_function()
Larry Hastings added the comment: In case a little background would help: while developing support for '__text_signature__' I had to move the test and the from_builtin() call to the top. It used to be more in the middle-ish. I don't have notes specifically on why I moved it, but I dimly recall that if I didn't try from_builtin first, there were other approaches that would succeed on the callable, that approach would fail on a builtin, so it'd throw an exception, and from_builtin wouldn't get a chance to try. Also, I assumed that anything that had a __text_signature__ wasn't going to have any other kind of signature information. Therefore, if the object had a __text_signature__ attribute, then I already knew that's the best approach and it should definitely be first. Also also, I remember specifically that the isinstance(type) code would fail builtin classes. But there's no generic way (that I know of) to tell whether a class is a user class or a builtin class. So I wanted from_builtin to try handling a class first before the isinstance(type) class. Are there callables in CPython that have *both* a __text_signature__ *and* have signature information derivable from another source, where you *don't* want to use __text_signature__? Stefan: yes, you can write any garbage you want after sig=( and the C function that detects signatures will still assume you have a text signature. That reminds me of a good joke. Patient: Doctor, it hurts whenever I move my arm in this funny way. *demonstrates* Doctor: Well, then, don't do that. I would be very interested if you knew of docstrings in the wild that innocently start with sig=( and yet aren't intended to be text signatures compatible with inspect.Signature. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17159 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20387] tokenize/untokenize roundtrip fails with tabs
Terry J. Reedy added the comment: The untokenize docstring has a stronger guarantee, and in the direction you were claiming. Round-trip invariant for full input: Untokenized source will match input source exactly. For this to be true, the indent strings must be saved and not replaced by spaces. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20387 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17159] Remove explicit type check from inspect.Signature.from_function()
Stefan Behnel added the comment: I assumed that anything that had a __text_signature__ wasn't going to have any other kind of signature information. Therefore, if the object had a __text_signature__ attribute, then I already knew that's the best approach and it should definitely be first. That's likely true for CPython itself, at least currently. I don't think it's generally a safe assumption in the CPython ecosystem, which includes things like Cython, Numba, Nuitka and others, i.e. a growing number of tools that can create function-like native callables with a signature that is worth introspecting. They may or may not provide a function-like signature, but if they do (and at least Cython and Nuitka provide one), then that's the best you can get. Reducing it to a string representation, especially now that we have annotations for Python signatures, sounds like a major step backwards. Are there callables in CPython that have *both* a __text_signature__ *and* have signature information derivable from another source, where you *don't* want to use __text_signature__? Anything that inherits from PyCFunction will inherit __text_signature__ automatically. I should mention that this inheritance is actually not allowed, according to the type flags in PyCFunction_Type. It's just that Cython has been doing it that way for years, mainly because there are some barriers in CPython (don't remember which) that prevent other types from doing similar things. I would be very interested if you knew of docstrings in the wild that innocently start with sig=( and yet aren't intended to be text signatures compatible with inspect.Signature. I agree that it's an unlikely start for a docstring. That's why it was chosen, after all. Safer ways to do it would be extending the type, or adding a flag in some way, but that's going to a) hurt more than the current situation, and b) become wasteful at some point when the __text_signature__ actually gets replaced by a proper function interface for CPython builtins. The fact that that wasn't doable for Py3.4 any more doesn't mean it shouldn't be done at all. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17159 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18577] lru_cache enhancement: lru_timestamp helper function
Peter Santoro added the comment: As requested, I published this for review on http://code.activestate.com/recipes/578817-lru_timestamp-cache-entry-aging-for-functoolslru_c/ -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18577 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20404] Delayed exception using non-text encodings with TextIOWrapper
Serhiy Storchaka added the comment: The _PyCodec_GetIncrementalDecoder name looks too similar to PyCodec_IncrementalDecoder. It would be better to use more different name. And please note my minor comments on Rietveld. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20404 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2008] cookielib lacks FileCookieJar class for Safari
Hendrik added the comment: Ok, i've got it. --- a/Lib/http/cookiejar.py Wed Dec 18 15:37:03 2013 -0600 +++ b/Lib/http/cookiejar.py Sat Feb 01 15:12:01 2014 +0100 @@ -11,17 +11,17 @@ distributed with the Python standard library, but are available from http://wwwsearch.sf.net/): -CookieJar -/ \ \ -FileCookieJar \ \ - /| \ \ \ - MozillaCookieJar | LWPCookieJar \ \ - | | \ - | ---MSIEBase | \ - | / | |\ - | / MSIEDBCookieJar BSDDBCookieJar - |/ - MSIECookieJar + CookieJar +/ \ \ +FileCookieJar \ \ + / / | \ \ \ +SafariCookieJar / | LWPCookieJar \ \ + /| | \ + MozillaCookieJar | ---MSIEBase | \ + | / | |\ + | / MSIEDBCookieJar BSDDBCookieJar + |/ + MSIECookieJar @@ -31,8 +31,11 @@ import copy import datetime import re +import getpass import time import urllib.parse, urllib.request +import struct +import io try: import threading as _threading except ImportError: @@ -40,6 +43,9 @@ import http.client # only for the default HTTP port from calendar import timegm +import difflib +#from difflib_data import * + debug = False # set to True to enable debugging via the logging module logger = None @@ -1938,6 +1944,109 @@ raise LoadError(invalid Set-Cookie3 format file %r: %r % (filename, line)) +class SafariCookieJar(FileCookieJar): + +Read Cookies from Safari + + +def load(self, filename=None): +if filename == None: +username = getpass.getuser() +path = '/Users/' + username + '/Library/Cookies/Cookies.binarycookies' +else: +path = filename + +bf=open(path,mode='rb') +scook = bf.read(4).decode(UTF-8) +if scook == 'cook': +NumberOfPages=struct.unpack('i',bf.read(4))[0] +page_sizes=[] +for np in range(NumberOfPages): +page_sizes.append(struct.unpack('i',bf.read(4))[0]) +pages=[] +for ps in page_sizes: +pages.append(bf.read(ps)) + +for page in pages: +page=io.BytesIO(page) +page.read(4) +num_cookies=struct.unpack('i',page.read(4))[0] +cookie_offsets=[] +for nc in range(num_cookies): +cookie_offsets.append(struct.unpack('i',page.read(4))[0]) + +page.read(4) + +cookie='' +for offset in cookie_offsets: +page.seek(offset) +cookiesize=struct.unpack('i',page.read(4))[0] +cookie=io.BytesIO(page.read(cookiesize)) + +cookie.read(4) + +flags=struct.unpack('i',cookie.read(4))[0] +cookie_flags='' +if flags==0: +cookie_flags='' +elif flags==1: +cookie_flags='Secure' +elif flags==4: +cookie_flags='HttpOnly' +elif flags==5: +cookie_flags='Secure; HttpOnly' +else: +cookie_flags='Unknown' + +cookie.read(4) + +urloffset=struct.unpack('i',cookie.read(4))[0] +nameoffset=struct.unpack('i',cookie.read(4))[0] +pathoffset=struct.unpack('i',cookie.read(4))[0] +valueoffset=struct.unpack('i',cookie.read(4))[0] + +endofcookie=cookie.read(8) + +expiry_date_epoch= struct.unpack('d',cookie.read(8))[0]+978307200 +expiry_date=time.strftime(%a, %d %b %Y ,time.gmtime(expiry_date_epoch))[:-1] + + create_date_epoch=struct.unpack('d',cookie.read(8))[0]+978307200 +create_date=time.strftime(%a, %d %b %Y ,time.gmtime(create_date_epoch))[:-1] + +cookie.seek(urloffset-4) +url='' +u=cookie.read(1) +while struct.unpack('b',u)[0]!=0: +url=url+u.decode('UTF-8') +u=cookie.read(1) + +cookie.seek(nameoffset-4) +name='' +n=cookie.read(1) +while struct.unpack('b',n)[0]!=0: +
[issue17159] Remove explicit type check from inspect.Signature.from_function()
Stefan Behnel added the comment: Ok, I think I figured it out now. Essentially, Cython's functions type, despite starting with the same struct layout as PyCFunction, must not visibly inherit from PyCFunction. Consequently, inspect.isbuiltin() returns False, as does inspect.isfunction() - sadly. With Yury's changes that are currently committed, this triggers the fallback that checks for the function-like signature, which in turn makes Signature.from_function() properly analyse the signature, including default arguments, annotations, etc. So, nothing left to change on CPython side for this ticket. And thanks again for the help. Closing as fixed. -- status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17159 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20389] clarify meaning of xbar and mu in pvariance/variance of statistics module
Changes by Steven D'Aprano steve+pyt...@pearwood.info: -- assignee: - stevenjd nosy: +stevenjd ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20389 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20479] Efficiently support weight/frequency mappings in the statistics module
Steven D'Aprano added the comment: Off the top of my head, I can think of three APIs: (1) separate functions, as Nick suggests: mean vs weighted_mean, stdev vs weighted_stdev (2) treat mappings as an implied (value, frequency) pairs (3) take an additional argument to switch between unweighted and weighted modes. I dislike #3, but will consider the others for 3.5. -- assignee: - stevenjd ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20479 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20478] Avoid inadvertently special casing Counter in statistics module
Changes by Steven D'Aprano steve+pyt...@pearwood.info: -- assignee: - stevenjd ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20478 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20481] Clarify type coercion rules in statistics module
Changes by Steven D'Aprano steve+pyt...@pearwood.info: -- assignee: - stevenjd ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20481 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19654] test_tkinter sporadic skipped on x86 Tiger 3.x buildbot
Serhiy Storchaka added the comment: The mystery remains why test_tk appears to alternately pass and fail on this buildbot. I don't see why it doesn't always fail. test_tk not fails in case when it is just skipped. And why it is sporadic skipped, this is very interesting question. -- title: test_tkinter sporadic failures on x86 Tiger 3.x buildbot - test_tkinter sporadic skipped on x86 Tiger 3.x buildbot ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19654 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2008] cookielib lacks FileCookieJar class for Safari
Changes by Hendrik hendrik.hoe...@googlemail.com: -- versions: +Python 3.4 -Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2008 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20479] Efficiently support weight/frequency mappings in the statistics module
Oscar Benjamin added the comment: On 2 February 2014 11:55, Steven D'Aprano rep...@bugs.python.org wrote: (1) separate functions, as Nick suggests: mean vs weighted_mean, stdev vs weighted_stdev This would be my preferred approach. It makes it very clear which functions are available for working with map style data. It will be clear from both the module documentation and a casual introspection of the module that those APIs are present for those who might want them. Also apart from mode() the implementation of each function on map-format data will be completely different from the iterable version so you'd want to have it as a separate function at least internally anyway. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20479 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20481] Clarify type coercion rules in statistics module
Oscar Benjamin added the comment: Wolfgang have you tested this with any third party numeric types from sympy, gmpy2, mpmath etc.? Last I checked no third party types implement the numbers ABCs e.g.: import sympy, numbers r = sympy.Rational(1, 2) r 1/2 isinstance(r, numbers.Rational) False AFAICT testing against the numbers ABCs is just a slow way of testing against the stdlib types: $ python -m timeit -s 'from numbers import Integral' 'isinstance(1, Integral)' 10 loops, best of 3: 2.59 usec per loop $ python -m timeit -s 'from numbers import Integral' 'isinstance(1, int)' 100 loops, best of 3: 0.31 usec per loop You can at least make it faster using a tuple: $ python -m timeit -s 'from numbers import Integral' 'isinstance(1, (int, Integral))' 100 loops, best of 3: 0.423 usec per loop I'm not saying that this is necessarily a worthwhile optimisation but rather that the numbers ABCs are in practice not really very useful (AFAICT). I don't know how well the statistics module currently handles third party numeric types but if the type coercion is to be changed then this something to look at. The current implementation tries to duck-type to some extent and yours uses ABCs but does either approach actually have any practical gain for interoperability with non-stdlib numeric types? If not then it would be simpler just to explicitly hard-code exactly how it works for the powerset of stdlib types. OTOH if it could be made to do sensible things with non-stdlib types then that would be great. Falling back on float isn't a bad choice but if it can be made to do exact things for exact types (e.g. sympy.Rational) then that would be great. Similarly mpmath.mpf provides multi-precision floats. It would be great to be able to take advantage of that higher precision rather than downgrade everything to float. This is in general a hard problem though so I don't think it's unreasonable to make restrictions about what types it can work with - achieving optimal accuracy for all types without restrictions is basically impossible. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20481 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20453] json.load() error message changed in 3.4
Serhiy Storchaka added the comment: No JSON object could be decoded, expecting value is too expensive and second part of this message just repeat first part. The message can be shortened to No JSON object could be decoded. But this is not fully correct. JSON term object corresponds to Python dict. But this error raised when arbitrary JSON value expected: object, array (corresponded to Python list), string, number or boolean. That is why I had changed object to value. So may be the No JSON value could be decoded is more correct. Also note other differences between 3.3 and 3.4: json.loads('[') 3.3: Expecting object: line 1 column 1 (char 0) 3.4: Expecting value: line 1 column 2 (char 1) json.loads('[,') 3.3: No JSON object could be decoded 3.4: Expecting value: line 1 column 2 (char 1) json.loads('[42') 3.3: Expecting object: line 1 column 3 (char 2) 3.4: Expecting ',' delimiter: line 1 column 4 (char 3) json.loads('[42,') 3.3: Expecting object: line 1 column 4 (char 3) 3.4: Expecting value: line 1 column 5 (char 4) json.loads('[') 3.3: end is out of bounds 3.4: Unterminated string starting at: line 1 column 2 (char 1) json.loads('[foo') 3.3: Unterminated string starting at: line 1 column 2 (char 1) 3.4: Unterminated string starting at: line 1 column 2 (char 1) To me new error messages look more informative and more correct. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20453 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20480] Add ipaddress property to get name of reverse DNS PTR record
Antoine Pitrou added the comment: I'd prefer to leave the trailing dots. It's the technically correct thing to do. It depends what we're talking about. Hostnames (in the general sense) don't carry a trailing dot except in DNS queries. So I'd argue the trailing dot is more part of the DNS protocol than of the hostname itself. As for what the host command does, it doesn't add any trailing dots here: $ host 127.0.0.1 1.0.0.127.in-addr.arpa domain name pointer XXX. $ host ::1 1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa domain name pointer XXX. (this is bind9-host from Ubuntu) The Wikipedia page doesn't use trailing dots: http://en.wikipedia.org/wiki/Reverse_DNS_lookup Neither do the examples from the RIPE itself: http://www.ripe.net/data-tools/dns/reverse-dns/how-to-set-up-reverse-delegation -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20480 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20453] json.load() error message changed in 3.4
Antoine Pitrou added the comment: To me new error messages look more informative and more correct. Yes, I agree with you. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20453 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20480] Add ipaddress property to get name of reverse DNS PTR record
Leon Weber added the comment: I’ve changed the wording in the documentation a bit and added an explanatory sentence, how about this? I think this should make pretty clear what it does and does not, and also easy to find in the documentation when searching for “reverse”, “PTR” and “pointer” (which is what I can think of what one would be looking for). (Not sure whether to add further patches in roundup or rietveld, but a quick google search reveals patches are periodically added to rietveld automatically, so I’ll just add it here. Please let me know if this is not correct :)) -- Added file: http://bugs.python.org/file33865/ipaddress_reverse_names_v3.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20480 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20311] epoll.poll(timeout) and PollSelector.select(timeout) must round the timeout to the upper bound
Changes by Serhiy Storchaka storch...@gmail.com: -- nosy: -serhiy.storchaka ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20311 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20480] Add ipaddress property to get name of reverse DNS PTR record
Leon Weber added the comment: As for what the host command does, it doesn't add any trailing dots here: Oh, interesting. It does on Fedora 19 with version 9.9.3, but not on my Ubuntu installation with version 9.8.1. So it seems this was added between 9.8.1 and 9.9.3. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20480 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15216] Support setting the encoding on a text stream after creation
Serhiy Storchaka added the comment: What about other TextIOWrapper parameters? I think newline should be changed in same cases as encoding and errors. And changing buffering and line_buffering can be useful too. What if add the configure or reopen method which accepts all this parameters? This will decrease the swelling of interface. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15216 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20480] Add ipaddress property to get name of reverse DNS PTR record
Antoine Pitrou added the comment: Oh, interesting. It does on Fedora 19 with version 9.9.3, but not on my Ubuntu installation with version 9.8.1. So it seems this was added between 9.8.1 and 9.9.3. According to apt-cache, the version I tried with is 1:9.9.3.dfsg.P2-4ubuntu1 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20480 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20440] Use Py_REPLACE/Py_XREPLACE macros
Serhiy Storchaka added the comment: I think Raymond's original concern still applies: The macros do add to the learning curve. I agree. But alternative solution is Victor's original patch which replaces potential bugs by inlined body of Py_REPLACE/Py_XREPLACE. This is explicit, but more verbose (2 lines are replaced by 5 lines with one new variable, with macros it would be one line), less clear and more errorprone. I believe that given the popularity of such a code and the possibility of mistakes, it is worth introducing special macros. Here apply the same reasoning as for Py_CLEAR. Of course these macros shouldn't be a part of stable API in 2.7 and 3.3 (and may be even in 3.4). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20440 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20479] Efficiently support weight/frequency mappings in the statistics module
Serhiy Storchaka added the comment: See also issue18844. -- nosy: +serhiy.storchaka ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20479 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20480] Add ipaddress property to get name of reverse DNS PTR record
Leon Weber added the comment: According to apt-cache, the version I tried with is 1:9.9.3.dfsg.P2-4ubuntu1 Ok, then it depends on something else apparently. It’s not so relevant anyway because even with the trailing dot, “host” is inconsistent between IPv4 and IPv6, and we should choose a consistent variant. I’m still slightly in favour of having the trailing dot, because it is the correct representation of the DNS name. RFC1034 section 3.1 explicitly states that “Since a complete domain name ends with the root label, this leads to a printed form which ends in a dot.”. It goes on to explain that relative names (names not ending in a dot) “appear mostly at the user interface, where their interpretation varies from implementation to implementation” and that the most common interpretation is relative to the root zone. So leaving the dot off is merely a convention, which is good enough for Wikipedia and RIPE documents; however I think in an API we should implement the more strict option. Also, I don’t see anything breaking with the dot, while without the dot, a user needs to take extra care when feeding the name to dnspython’s dns.resolver.query(), which would do undesired things without the trailing dot (append a search domain if there is one in /etc/resolv.conf). Any other opinions? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20480 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20480] Add ipaddress property to get name of reverse DNS PTR record
Antoine Pitrou added the comment: Well that convention is also used in existing APIs: socket.gethostbyaddr(8.8.8.8) ('google-public-dns-a.google.com', [], ['8.8.8.8']) (note that this merely reflects a POSIX API) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20480 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20485] Enable 'import Non-ASCII.pyd'
New submission from Suzumizaki: Currently, the name of .pyd modules is limited within 7 bit US-ASCII. I want to do import X to import X.pyd, where X contains Unicode characters. I tried to make the patch and my work seems to be done successfully. I will post the patch with this issue, and next what should I do? About the solution: To make the export entry 'PyInit_xxx' kept inside 7 bit, I use the simple encoding 'szm62' for unicode, called in the patch. 1) 'szm62' is used once per module(.pyd), only for 'PyInit_xxx'. 2) 'szm62' is used only when non-ASCII characters are in the name of the module. 3) 'szm62' generates short string as UTF-8, except 0-9A-Za-z are encoded to 2 bytes. 4) 'szm62' is very simple, much easier than UTF-8. 5) I tested it only with MS VC++, but I believe highly compatible with other environments. 6) 'szm62' also can decode 7 bits to unicode, but only the encoding is used for this issue. Notes: The simplicity is important for the project like Cython -- it generates .pyd files. The codepoints over 16bits are also simply supported. They will be encoded to 4 alnum(0-9A-Za-z) characters. 0-9A-Za-z are (always) encoded to 2 alnums. They will be simply prefixed with '0'(U+30). When the generating 'Non-ASCII.pyd' with MSVC toolkit, the report 'LINK : warning LNK4232' will be raised on linking. But no problem. The warning says When someone try to link with LoadLibraryEx'A' function, it may or may not fail, depends on the user locale. Our Python.exe uses always LoadLibraryEx'W', it never fail with locale issue. Or if you have any question, please tell me that. Regards, Suzumizaki-Kimitaka -- components: Interpreter Core files: 20140202_patch_for_python_default_branch_5.patch keywords: patch messages: 209988 nosy: Suzumizaki priority: normal severity: normal status: open title: Enable 'import Non-ASCII.pyd' type: behavior versions: Python 3.3, Python 3.4, Python 3.5 Added file: http://bugs.python.org/file33866/20140202_patch_for_python_default_branch_5.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20485 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20485] Enable 'import Non-ASCII.pyd'
Changes by Suzumizaki suzumiz...@free.japandesign.ne.jp: Added file: http://bugs.python.org/file33867/20140202_patch_for_python3.3_4.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20485 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8743] set() operators don't work with collections.Set instances
Serhiy Storchaka added the comment: I think set operations with iterable (but not set) should be tested. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8743 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20485] Enable 'import Non-ASCII.pyd'
Changes by Suzumizaki suzumiz...@free.japandesign.ne.jp: Added file: http://bugs.python.org/file33868/sample_importing_non_ascii_pyd.zip ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20485 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20466] Example in Doc/extending/embedding.rst fails to compile cleanly
Saimadhav Heblikar added the comment: Patch fixes the mistake. Looks like it was copied over from earlier version. -- keywords: +patch nosy: +sahutd Added file: http://bugs.python.org/file33869/issue20466.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20466 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20485] Enable 'import Non-ASCII.pyd'
Changes by Antoine Pitrou pit...@free.fr: -- nosy: +brett.cannon, eric.snow, haypo, ncoghlan ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20485 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20166] window x64 c-extensions not works on python3.4.0b2
Jeremy Kloth added the comment: Issue #16779 has a patch that suppresses the warning for 64-bit builds that would also fix #9709. -- nosy: +jkloth ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20166 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20486] msilib: can't close opened database
New submission from Игорь Шаула: In Python 2.7.6 can't find any way to close MSI database after finish working with it. As a result database is locked and can't be opened by any other application until Python process is finished. import msilib db = msilib.OpenDatabase('test.msi', msilib.MSIDBOPEN_TRANSACT) view = db.OpenView(SELECT File, Component_, FileName FROM File) view.Execute(None) r1 = view.Fetch() r1.SetString(3,test.txt) view.Modify(msilib.MSIMODIFY_UPDATE, r1) view.Close() db.Commit() del db db2 = msilib.OpenDatabase('test.msi', msilib.MSIDBOPEN_TRANSACT) MSIError: 1: 2203 2: test.msi 3: -2147287008 -- components: Library (Lib), Windows messages: 209992 nosy: gentoo90 priority: normal severity: normal status: open title: msilib: can't close opened database type: behavior versions: Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20486 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20487] Odd words in unittest.mock document.
New submission from INADA Naoki: http://docs.python.org/3.3/library/unittest.mock.html#magic-mock The two equality method, __eq__ and __ne__, are special. They do the default equality comparison on identity, using a side effect, unless you change their return value to return something else: What using a side effect means? -- assignee: docs@python components: Documentation messages: 209993 nosy: docs@python, michael.foord, naoki priority: normal severity: normal status: open title: Odd words in unittest.mock document. versions: Python 3.3, Python 3.4, Python 3.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20487 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20488] importlib title and introduction are out of date
New submission from R. David Murray: Now that importlib *is* the import system in CPython, the title (An Implementation of import) and the intro (a reference implementation that is easier to comprehend than... seem to me like they are out of date and should be reworded. -- assignee: docs@python components: Documentation messages: 209994 nosy: brett.cannon, docs@python, eric.snow, r.david.murray priority: normal severity: normal status: open title: importlib title and introduction are out of date type: behavior versions: Python 3.3, Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20488 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20480] Add ipaddress property to get name of reverse DNS PTR record
Eric V. Smith added the comment: I concede the point on the trailing dot. The reason we used to always use it is that it prevented the local resolver from first trying to append the host's default domain name (as, for example, defined in /etc/resolv.conf as search). I have no idea if resolvers still do that. Some quick research shows that that's probably not their behavior any more, at least if the domain name contains at least one dot. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20480 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20480] Add ipaddress property to get name of reverse DNS PTR record
Eric V. Smith added the comment: The documentation change looks good to me. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20480 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18321] Multivolume support in tarfile module
Lars Gustäbel added the comment: I had the following idea: What about a separate class, let's call it TarVolumeSet for now, that maps a set of (virtual) volumes onto one big file-like object. This TarVolumeSet will be passed to a TarFile constructor as the fileobj argument. It is subclassable for implementing custom behavior. class MyTarVolumeSet(tarfile.TarVolumeSet): def __init__(self, template): self.template = template def open_volume(self, volume_number): return open(self.template % volume_number, rb) volumes = MyTarVolumesSet(test.tar.%03d) with tarfile.open(fileobj=volumes, mode=r:) as tar: for t in tar: print(t.name) In my opinion, this approach has a number of advantages: Most importantly, it separates the multi-volume code from the TarFile class, which reduces the invasiveness, complexity and maintenance burden of the original approach. The TarFile class would be totally agnostic about the concept of multiple volumes, TarVolumeSet looks just like another file-object to TarFile. Looks like the cleanest solution to me so far. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18321 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20485] Enable 'import Non-ASCII.pyd'
Serhiy Storchaka added the comment: I think that if you need a module with non-ASCII name, you can wrap it in Python module. === späm.py === from _spam import * from _spam import __all__, __doc__ === späm.py === -- nosy: +serhiy.storchaka ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20485 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15955] gzip, bz2, lzma: add option to limit output size
Nadeem Vawda added the comment: After some consideration, I've come to agree with Serhiy that it would be better to keep a private internal buffer, rather than having the user manage unconsumed input data. I'm also in favor of having a flag to indicate whether the decompressor needs more input to produce more decompressed data. (I'd prefer to call it 'needs_input' or similar, though - 'data_ready' feels too vague to me.) In msg176883 and msg177228, Serhiy raises the possibility that the compressor might be unable to produce decompressed output from a given piece of (non-empty) input, but will still leave the input unconsumed. I do not think that this can actually happen (based on the libraries' documentation), but this API will work even if that situation can occur. So, to summarize, the API will look like this: class LZMADecompressor: ... def decompress(self, data, max_length=-1): Decompresses *data*, returning uncompressed data as bytes. If *max_length* is nonnegative, returns at most *max_length* bytes of decompressed data. If this limit is reached and further output can be produced, *self.needs_input* will be set to False. In this case, the next call to *decompress()* should provide *data* as b'' to obtain more of the output. If all of the input data was decompressed and returned (either because this was less than *max_length* bytes, or because *max_length* was negative), *self.needs_input* will be set to True. ... Data not consumed due to the use of 'max_length' should be saved in an internal buffer (that is not exposed to Python code at all), which is then prepended to any data provided in the next call to decompress() before providing the data to the underlying compression library. The cases where either the internal buffer or the new data are empty should be optimized to avoid unnecessary allocations or copies, since these will be the most common cases. Note that this API does not need a Python-level 'unconsumed_tail' attribute - its role is served by the internal buffer (which is private to the C module implementation). This is not to be confused with the already-existing 'unused_data' attribute that stores data found after the end of the compressed stream. 'unused_data' should continue to work as before, regardless of whether decompress() is called with a max_length argument or not. As a starting point I would suggest writing a patch for LZMADecompressor first, since its implementation is a bit simpler than BZ2Decompressor. Once this patch and an analogous one for BZ2Decompressor have been committed, we can then convert GzipFile, BZ2File and LZMAFile to use this feature. If you have any questions while you're working on this issue, feel free to send them my way. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15955 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20480] Add ipaddress property to get name of reverse DNS PTR record
Leon Weber added the comment: I can live without the trailing dot, although I’d find it “more correct” to have it. I’ve attached an alternative patch that doesn’t return a trailing dot, it’s up to you guys to decide which one you prefer. -- Added file: http://bugs.python.org/file33870/ipaddress_reverse_names_v3_alt.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20480 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16779] Fix compiler warning when building extension modules on 64-bit Windows
Changes by Stefan Krah stefan-use...@bytereef.org: -- assignee: eric.araujo - resolution: duplicate - stage: committed/rejected - needs patch status: closed - open ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16779 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16779] Fix compiler warning when building extension modules on 64-bit Windows
Changes by Stefan Krah stefan-use...@bytereef.org: -- stage: needs patch - patch review ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16779 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20489] help() fails for zlib Compress and Decompress objects
New submission from Serhiy Storchaka: import zlib d = zlib.decompressobj() d zlib.Decompress object at 0xb70a9288 c = zlib.compressobj() c zlib.Compress object at 0xb6f85ac8 zlib.DEF_BUF_SIZE 16384 zlib.Z_FINISH 4 help(c) Traceback (most recent call last): File /home/serhiy/py/cpython/Lib/inspect.py, line 2243, in wrap_value value = eval(s, module_dict) File string, line 1, in module NameError: name 'Z_FINISH' is not defined During handling of the above exception, another exception occurred: Traceback (most recent call last): File /home/serhiy/py/cpython/Lib/inspect.py, line 2246, in wrap_value value = eval(s, sys_module_dict) File string, line 1, in module NameError: name 'Z_FINISH' is not defined During handling of the above exception, another exception occurred: Traceback (most recent call last): File stdin, line 1, in module File /home/serhiy/py/cpython/Lib/_sitebuiltins.py, line 99, in __call__ return pydoc.help(*args, **kwds) File /home/serhiy/py/cpython/Lib/pydoc.py, line 1799, in __call__ self.help(request) File /home/serhiy/py/cpython/Lib/pydoc.py, line 1849, in help else: doc(request, 'Help on %s:', output=self._output) File /home/serhiy/py/cpython/Lib/pydoc.py, line 1585, in doc pager(render_doc(thing, title, forceload)) File /home/serhiy/py/cpython/Lib/pydoc.py, line 1578, in render_doc return title % desc + '\n\n' + renderer.document(object, name) File /home/serhiy/py/cpython/Lib/pydoc.py, line 357, in document if inspect.isclass(object): return self.docclass(*args) File /home/serhiy/py/cpython/Lib/pydoc.py, line 1276, in docclass lambda t: t[1] == 'method') File /home/serhiy/py/cpython/Lib/pydoc.py, line 1225, in spill name, mod, object)) File /home/serhiy/py/cpython/Lib/pydoc.py, line 358, in document if inspect.isroutine(object): return self.docroutine(*args) File /home/serhiy/py/cpython/Lib/pydoc.py, line 1328, in docroutine signature = inspect.signature(object) File /home/serhiy/py/cpython/Lib/inspect.py, line 1695, in signature return Signature.from_builtin(obj) File /home/serhiy/py/cpython/Lib/inspect.py, line 2298, in from_builtin p(name, default) File /home/serhiy/py/cpython/Lib/inspect.py, line 2284, in p default_node = RewriteSymbolics().visit(default_node) File /home/serhiy/py/cpython/Lib/ast.py, line 245, in visit return visitor(node) File /home/serhiy/py/cpython/Lib/inspect.py, line 2276, in visit_Name return wrap_value(node.id) File /home/serhiy/py/cpython/Lib/inspect.py, line 2248, in wrap_value raise RuntimeError() RuntimeError help(d) Traceback (most recent call last): File /home/serhiy/py/cpython/Lib/inspect.py, line 2243, in wrap_value value = eval(s, module_dict) File string, line 1, in module NameError: name 'DEF_BUF_SIZE' is not defined During handling of the above exception, another exception occurred: Traceback (most recent call last): File /home/serhiy/py/cpython/Lib/inspect.py, line 2246, in wrap_value value = eval(s, sys_module_dict) File string, line 1, in module NameError: name 'DEF_BUF_SIZE' is not defined During handling of the above exception, another exception occurred: Traceback (most recent call last): File stdin, line 1, in module File /home/serhiy/py/cpython/Lib/_sitebuiltins.py, line 99, in __call__ return pydoc.help(*args, **kwds) File /home/serhiy/py/cpython/Lib/pydoc.py, line 1799, in __call__ self.help(request) File /home/serhiy/py/cpython/Lib/pydoc.py, line 1849, in help else: doc(request, 'Help on %s:', output=self._output) File /home/serhiy/py/cpython/Lib/pydoc.py, line 1585, in doc pager(render_doc(thing, title, forceload)) File /home/serhiy/py/cpython/Lib/pydoc.py, line 1578, in render_doc return title % desc + '\n\n' + renderer.document(object, name) File /home/serhiy/py/cpython/Lib/pydoc.py, line 357, in document if inspect.isclass(object): return self.docclass(*args) File /home/serhiy/py/cpython/Lib/pydoc.py, line 1276, in docclass lambda t: t[1] == 'method') File /home/serhiy/py/cpython/Lib/pydoc.py, line 1225, in spill name, mod, object)) File /home/serhiy/py/cpython/Lib/pydoc.py, line 358, in document if inspect.isroutine(object): return self.docroutine(*args) File /home/serhiy/py/cpython/Lib/pydoc.py, line 1328, in docroutine signature = inspect.signature(object) File /home/serhiy/py/cpython/Lib/inspect.py, line 1695, in signature return Signature.from_builtin(obj) File /home/serhiy/py/cpython/Lib/inspect.py, line 2298, in from_builtin p(name, default) File /home/serhiy/py/cpython/Lib/inspect.py, line 2284, in p default_node = RewriteSymbolics().visit(default_node) File /home/serhiy/py/cpython/Lib/ast.py, line 245, in visit return visitor(node) File /home/serhiy/py/cpython/Lib/inspect.py, line 2276, in visit_Name return wrap_value(node.id) File /home/serhiy/py/cpython/Lib/inspect.py, line 2248, in
[issue20485] Enable 'import Non-ASCII.pyd'
Amaury Forgeot d'Arc added the comment: I'd use a much simpler encoding. Maybe something like name.encode('unicode-escape').replace(b'\\', b'_') As you said, simplicity is important for tools which generate code! -- nosy: +amaury.forgeotdarc ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20485 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17159] Remove explicit type check from inspect.Signature.from_function()
Yury Selivanov added the comment: Stefan, inspect.isbuiltin() returns False Are you absolutely sure about this? Please check that everything works with this latest change http://hg.python.org/cpython/rev/48c3c42e3e5c -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17159 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17159] Remove explicit type check from inspect.Signature.from_function()
Yury Selivanov added the comment: Larry, Also, I assumed that anything that had a __text_signature__ wasn't going to have any other kind of signature information. Therefore, if the object had a __text_signature__ attribute, then I already knew that's the best approach and it should definitely be first. I think that __text_signature__ is similar to the __signature__ attribute, i.e. if an object has it, then it should blindly use it, without trying anything else (where __signature__ should have a higher priority than __text_signature__) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17159 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20473] inspect.Signature no longer handles builtin classes correctly
Yury Selivanov added the comment: Larry, Quoting your reply from #17159: Also also, I remember specifically that the isinstance(type) code would fail builtin classes. Could you please find an example of this? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20473 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20490] Show clear error message on circular import
New submission from Ram Rachum: If there's a circular import in my program, I don't want to see an error message, Cannot import name 'foo' and then say in my mind, ah, I'm an experienced Python developer, I know that when Python says that it often means that there's a circular import problem. I want the error message to **say there's a circular import problem**, so (a) I won't have to remember this piece of trivia and (b) less experienced developers won't have to bang their heads on their desks trying to figure out why the import isn't working. Bonus points if the error message actually shows which module is trying to import a module that imports itself, so we'll know where to fix. -- components: Interpreter Core messages: 210006 nosy: cool-RR priority: normal severity: normal status: open title: Show clear error message on circular import type: enhancement versions: Python 3.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20490 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20490] Show clear error message on circular import
Changes by Yury Selivanov yselivanov...@gmail.com: -- nosy: +brett.cannon ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20490 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20490] Show clear error message on circular import
Changes by Yury Selivanov yselivanov...@gmail.com: -- nosy: +yselivanov ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20490 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20490] Show clear error message on circular import
Changes by R. David Murray rdmur...@bitdance.com: -- nosy: +r.david.murray ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20490 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20487] Odd words in unittest.mock document.
Michael Foord added the comment: A side effect is a mechanism Mock provides for mocks to have special behaviour when called. http://docs.python.org/3.3/library/unittest.mock.html#unittest.mock.Mock.side_effect The term is used very widely throughout the mock documentation, so I don't think it's appropriate to link *every* usage to the side_effect documentation. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20487 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20311] epoll.poll(timeout) and PollSelector.select(timeout) must round the timeout to the upper bound
STINNER Victor added the comment: Buildbots are happy, I close the issue. -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20311 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20102] shutil._make_zipfile possible resource leak
Roundup Robot added the comment: New changeset 767d034b3feb by Benjamin Peterson in branch '2.7': use with statement to ensure zipfile is always closed (closes #20102) http://hg.python.org/cpython/rev/767d034b3feb New changeset 838674d15b5b by Benjamin Peterson in branch '3.3': use with statement to ensure zipfile is always closed (closes #20102) http://hg.python.org/cpython/rev/838674d15b5b New changeset 20aa07f93ca7 by Benjamin Peterson in branch 'default': merge 3.3 (#20102) http://hg.python.org/cpython/rev/20aa07f93ca7 -- nosy: +python-dev resolution: - fixed stage: - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20102 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19761] test_tk fails on OS X with multiple test case failures with both Tk 8.5 and 8.4
Serhiy Storchaka added the comment: Thank you Ned for your great investigation. Here is a patch for these two bugs. A test for invalid bitmap is skipped (also added a test for bitmap specified in external file). For insertborderwidth tests the insertwidth value is explicitly increased (yes, the Tk source code bounds insertborderwidth by insertwidth/2). -- keywords: +patch stage: needs patch - patch review Added file: http://bugs.python.org/file33871/issue19761.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19761 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20350] Replace tkapp.split() to tkapp.splitlist()
Serhiy Storchaka added the comment: If there are no objections I'll commit this patch tomorrow. -- assignee: - serhiy.storchaka ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20350 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20368] Tkinter: handle the null character
Serhiy Storchaka added the comment: If there are no objections I'll commit this patch tomorrow. -- assignee: - serhiy.storchaka ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20368 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20491] textwrap: Non-breaking space not honored
New submission from Kaarle Ritvanen: The textwrap module does not distinguish non-breaking space (\xa0) from other whitespace when determining word boundaries. In the beginning of the module, the _whitespace variable is defined to address this issue but is not used in the regular expressions determining the splitting rules. -- components: Library (Lib) files: textwrap-honor-non-breaking-spaces.patch keywords: patch messages: 210013 nosy: kunkku priority: normal severity: normal status: open title: textwrap: Non-breaking space not honored type: behavior versions: Python 3.3, Python 3.4, Python 3.5 Added file: http://bugs.python.org/file33872/textwrap-honor-non-breaking-spaces.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20491 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20384] os.open() exception doesn't contain file name on Windows
Serhiy Storchaka added the comment: Larry, what would you say about os.open() error? -- nosy: +larry ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20384 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20492] test_tcl is failing on windows 2.7
New submission from Benjamin Peterson: http://buildbot.python.org/all/builders/x86%20Windows%20Server%202003%20%5BSB%5D%202.7/builds/833/steps/test/logs/stdio -- assignee: serhiy.storchaka messages: 210014 nosy: benjamin.peterson, serhiy.storchaka priority: normal severity: normal status: open title: test_tcl is failing on windows 2.7 versions: Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20492 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16074] Bad error message in os.rename, os.link, and os.symlink
Serhiy Storchaka added the comment: Larry, are you agree with this solution (remove ambiguous filename attribute from OSError raised by functions with two filename arguments)? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16074 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19320] Tkinter tests ran with wantobjects is false
Roundup Robot added the comment: New changeset 515e6afd2f0f by Serhiy Storchaka in branch '2.7': Issue #19320: Fixed split/splitlist tests in test_tcl for Tcl 8.5.0-8.5.5. http://hg.python.org/cpython/rev/515e6afd2f0f New changeset e6363a42a9f0 by Serhiy Storchaka in branch '3.3': Issue #19320: Fixed split/splitlist tests in test_tcl for Tcl 8.5.0-8.5.5. http://hg.python.org/cpython/rev/e6363a42a9f0 New changeset f2fdafe73ab6 by Serhiy Storchaka in branch 'default': Issue #19320: Fixed split/splitlist tests in test_tcl for Tcl 8.5.0-8.5.5. http://hg.python.org/cpython/rev/f2fdafe73ab6 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19320 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20492] test_tcl is failing on windows 2.7
Serhiy Storchaka added the comment: Thank you Benjamin, I just have fixed it in issue19320. -- resolution: - duplicate stage: - committed/rejected status: open - closed superseder: - Tkinter tests ran with wantobjects is false ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20492 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20491] textwrap: Non-breaking space not honored
Changes by Serhiy Storchaka storch...@gmail.com: -- nosy: +georg.brandl, serhiy.storchaka stage: - test needed versions: +Python 2.7 -Python 3.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20491 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20435] Discrepancy between io.StringIO and _pyio.StringIO with univeral newlines
Antoine Pitrou added the comment: It's a bug in _pyio.StringIO.getvalue(). Attaching patch. -- keywords: +patch Added file: http://bugs.python.org/file33873/stringio_getvalue.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20435 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15216] Support setting the encoding on a text stream after creation
Nikolaus Rath added the comment: The attached patch now passes all testcases. However, every invocation of set_encoding() when there is buffered data leaks one reference. I haven't been able to find the error yet. As for adding a reopen() or configure() method: I don't like it very much, but for the same reasons that I still don't like set_encoding() itself: it makes a rather fragile operation appear well-supported. set_encoding already inserts BOM in the middle of non-seekable streams, and invalidates tell cookies for seekable streams. Changing the buffering would probably face similar problems if there is buffered data but buffering is supposed to be turned off. I think it would be better to restrict this functionality strictly to sys.stdin/out/err and in all other situations fix the API that results in the TextIO object with undesired parameters. For example, in the case of the subprocess module, wouldn't it be better to return pipes as byte streams and have the caller wrap them into text streams? -- Added file: http://bugs.python.org/file33874/set_encoding-5.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15216 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20423] io.StringIO newline param has wrong default
Roundup Robot added the comment: New changeset 82cfab2ad98d by Antoine Pitrou in branch '3.3': Issue #20423: fix documentation of io.StringIO's newline parameter http://hg.python.org/cpython/rev/82cfab2ad98d New changeset 69a2cc048c80 by Antoine Pitrou in branch '2.7': Issue #20423: fix documentation of io.StringIO's newline parameter http://hg.python.org/cpython/rev/69a2cc048c80 New changeset df2efd48227e by Antoine Pitrou in branch 'default': Issue #20423: fix documentation of io.StringIO's newline parameter http://hg.python.org/cpython/rev/df2efd48227e -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20423 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20423] io.StringIO newline param has wrong default
Antoine Pitrou added the comment: The docs are now fixed, thank you! -- resolution: - fixed stage: needs patch - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20423 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20311] epoll.poll(timeout) and PollSelector.select(timeout) must round the timeout to the upper bound
Charles-François Natali added the comment: Well, now that timeouts are properly rounded, the granularity is useless. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20311 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20311] epoll.poll(timeout) and PollSelector.select(timeout) must round the timeout to the upper bound
STINNER Victor added the comment: Well, now that timeouts are properly rounded, the granularity is useless. I don't think so. Please read again the issue #20452, for example this message: http://bugs.python.org/issue20452#msg209772 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20311 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20452] test_timeout_rounding() of test_asyncio fails on x86 Ubuntu Shared 3.x buildbot
STINNER Victor added the comment: Buildbots are happy, I close the issue. -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20452 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20491] textwrap: Non-breaking space not honored
Antoine Pitrou added the comment: Thanks for the patch, Kaarle. Could you add some tests in Lib/test/test_textwrap? Also, for your contribution to be integrated, we'll need you to sign a contributor's agreement: http://www.python.org/psf/contrib/contrib-form/ -- nosy: +pitrou ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20491 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19990] Add unittests for imghdr module
Roundup Robot added the comment: New changeset e2d013e90e88 by Ned Deily in branch '2.7': Issue #19990: Install test/imghdrdata. http://hg.python.org/cpython/rev/e2d013e90e88 New changeset 5fbe155e62b0 by Ned Deily in branch '3.3': Issue #19990: Install test/imghdrdata. http://hg.python.org/cpython/rev/5fbe155e62b0 New changeset b41ba99a276c by Ned Deily in branch 'default': Issue #19990: Install test/imghdrdata. http://hg.python.org/cpython/rev/b41ba99a276c -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19990 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20435] Discrepancy between io.StringIO and _pyio.StringIO with univeral newlines
Serhiy Storchaka added the comment: I rather think that it's a bug in _io.StringIO.getvalue(). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20435 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20311] epoll.poll(timeout) and PollSelector.select(timeout) must round the timeout to the upper bound
Charles-François Natali added the comment: I don't think so. Please read again the issue #20452, for example this message: http://bugs.python.org/issue20452#msg209772 Ok, it looks better: waiting 99.9 ms took 99.6 ms and 99.9 ms, and waiting 9.9 ms took 9.7 ms. So as I said, the granularity (of 1 ms) is still needed in asyncio (dt timeout is sometimes False, but dt+granulary = timeout is always True). Sorry, I still fail to see how waking up after 99.6ms instead of 99.9ms is an issue: I've asked you several times to provide an actual example of a problem, and you still haven't. Once again: a slight early wakeup isn't an issue, you'll just call epoll()/select() once again. All even loops work this way, and noone ever complained. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20311 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20481] Clarify type coercion rules in statistics module
Wolfgang Maier added the comment: Hi Oscar, well, I haven't used sympy much, and I have no experience with the others, but in light of your comment I quickly checked sympy and gmpy2. You are right about them still not using the numbers ABCs, however, on your advise I also checked how the current statistics module implementation handles their numeric types and the answer is: it doesn't, and this is totally independent of the _coerce_types issue. For sympy: the problem lies with statistics._exact_ratio, which cannot convert sympy numeric types to a numerator/denominator tuple (a prerequisite for _sum) For gmpy2: the problem occurs just one step further down the road. gmpy2.Rationals have numerator and denominator properties, so _exact_ratio knows how to handle them, but the elements of the returned tuple are of type gmpy2.mpz (gmpy2's integer equivalent) and when _sum tries to convert the tuple into a Fraction you get: TypeError: both arguments should be Rational instances which is precisely because the mpz type is not integrated into the numbers tower. This last example is very illustrative I think because it shows that already now the standard library (the fractions module in this case) requires numeric types to comply with the numeric tower, so statistics would not be without precedent, and I think this is totally justified: after all this is the standard library (can't believe I'm saying this since I really got into this sort of by accident) and third party libraries should seek compatibility, but the standard library just needs to be self-consistent. I guess using ABCs over a duck-typing approach when coercing types, in fact, offers a huge advantage for third party libraries since they only need to register their types with the numbers ABC to achieve compatibility, while they need to consider complicated subclassing schemes with the current approach (of course, I am only talking about compatibility with _coerce_types here, which is the focus of this issue. Other parts of statistics may impose further restrictions as we've just seen for _sum). Finally, regarding speed. The fundamental difference between the current implementation and my proposed change is that the current version calls _coerce_types for every number in the input sequence, so performance is critical here, but in my version _coerce_types gets called only once and then operates on a really small set of input types, so it is absolutely not the time-critical step in the overall performance of _sum. For this very reason I made no effort at all to optimize the code, but just tried to keep it as simple and clear as possible. This, in fact, is IMHO the second major benefit of my proposal for _coerce_types (besides making its result order-independent). Read the current code for _coerce_types, then the proposed one. Try to consider all their ramifications and side-effects and decide which one's easier to understand and maintain. Best, Wolfgang -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20481 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20435] Discrepancy between io.StringIO and _pyio.StringIO with univeral newlines
Antoine Pitrou added the comment: With the patch, getvalue() is consistent with read() and other methods. Without the patch, _pyio.StringIO.getvalue() returns a different value from _pyio.StringIO.read() *and* from _io.StringIO.getvalue(). Changing _pyio.StringIO.getvalue() is the path of least resistance here. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20435 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19761] test_tk fails on OS X with multiple test case failures with both Tk 8.5 and 8.4
Ned Deily added the comment: The supplied patch fixed all of the failing test cases on OS X, tested on 3.3 and default with Cocoa Tk 8.5 8.6, Carbon Tk 8.4, and X11 Tk 8.6. I'll test on 2.7 after the modified patch is applied. Thanks, Serhiy! -- stage: patch review - commit review versions: +Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19761 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20435] Discrepancy between io.StringIO and _pyio.StringIO with univeral newlines
Antoine Pitrou added the comment: In other words, the bug is that _pyio.StringIO.getvalue() doesn't do any newline conversion; the patch fixes that. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20435 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20311] epoll.poll(timeout) and PollSelector.select(timeout) must round the timeout to the upper bound
STINNER Victor added the comment: Once again: a slight early wakeup isn't an issue That's your opinion, but I disagree. Please open a new issue with a patch, or reopen at least this issue because it is now closed. I already spent to much time on this issue. Buildbots are now happy, I don't want to change this again. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20311 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20475] pystone.py in 3.4 still uses time.clock(), even though it's marked as deprecated since 3.3
STINNER Victor added the comment: The problem with pystone is that such tool is used to compare performances between different versions of Python. If pystone uses a different clock in Python 3.4, you may not be able to compare compare results with older Python versions. In my opinion, such change should not be done before Python 3.5. 3.4 beta 3 has already been released. -- versions: +Python 3.5 -Python 3.3, Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20475 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20472] test_write_pty() of test_asyncio fails on x86 Tiger 3.x buildbot
STINNER Victor added the comment: Here is a patch to skip the tests for SelectSelector on Mac OS X older than 10.6 (Snow Leopard). @Ned: Could you please try it? I don't have access to such old Mac OS X versions. (I now only have a iMac running 10.9). -- keywords: +patch Added file: http://bugs.python.org/file33875/asyncio_pty_osx.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20472 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20455] test_asyncio hangs on Windows
Changes by STINNER Victor victor.stin...@gmail.com: -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20455 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20470] Fatal Python error: Bus error on the SPARC Solaris 10 buildbot
STINNER Victor added the comment: Cool, the tests are no more crashing on this buildbot. I close the issue. -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20470 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20479] Efficiently support weight/frequency mappings in the statistics module
Wolfgang Maier added the comment: -Ursprüngliche Nachricht- Von: Steven D'Aprano [mailto:rep...@bugs.python.org] Gesendet: Sonntag, 2. Februar 2014 12:55 An: wolfgang.ma...@biologie.uni-freiburg.de Betreff: [issue20479] Efficiently support weight/frequency mappings in the statistics module Steven D'Aprano added the comment: Off the top of my head, I can think of three APIs: (1) separate functions, as Nick suggests: mean vs weighted_mean, stdev vs weighted_stdev (2) treat mappings as an implied (value, frequency) pairs (2) is clearly my favourite. (1) may work well, if you have a module with a small fraction of functions, for which you need an alternate API. In the statistics module, however, almost all of its current functions could profit from having a way to treat mappings specially. In such a case, (1) is prone to create lots of redundancies. I do not share Oscar's opinion that apart from mode() the implementation of each function on map-format data will be completely different from the iterable version so you'd want to have it as a separate function at least internally anyway. Consider _sum's current code (docstring omitted for brevity): def _sum(data, start=0): n, d = _exact_ratio(start) T = type(start) partials = {d: n} # map {denominator: sum of numerators} # Micro-optimizations. coerce_types = _coerce_types exact_ratio = _exact_ratio partials_get = partials.get # Add numerators for each denominator, and track the current type. for x in data: T = _coerce_types(T, type(x)) n, d = exact_ratio(x) partials[d] = partials_get(d, 0) + n if None in partials: assert issubclass(T, (float, Decimal)) assert not math.isfinite(partials[None]) return T(partials[None]) total = Fraction() for d, n in sorted(partials.items()): total += Fraction(n, d) if issubclass(T, int): assert total.denominator == 1 return T(total.numerator) if issubclass(T, Decimal): return T(total.numerator)/total.denominator return T(total) all you'd have to do to treat mappings as proposed here is to add a check whether we are dealing with a mapping, then in this case, instead of the for loop: for x in data: T = _coerce_types(T, type(x)) n, d = exact_ratio(x) partials[d] = partials_get(d, 0) + n use this: for x,m in data.items(): T = _coerce_types(T, type(x)) n, d = exact_ratio(x) partials[d] = partials_get(d, 0) + n*m and no other changes (though I haven't tested this carefully). Wolfgang -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20479 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20435] Discrepancy between io.StringIO and _pyio.StringIO with univeral newlines
Serhiy Storchaka added the comment: But how then other values of newline except '\n' can be useful? The problem is that newline converting is applied twice, in write() and in read(). When constructor uses write() and getvalue() returns same value as read(), we have no chance to get newlines encoded or decoded only once. Current results for newline != '\n' looks meanless to me. Here is my half-baked patch. It fixes only _pyio.StringIO, but _io.StringIO are still partially broken. The patch also contains new tests. -- Added file: http://bugs.python.org/file33876/stringio_newline.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20435 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20311] epoll.poll(timeout) and PollSelector.select(timeout) must round the timeout to the upper bound
Charles-François Natali added the comment: Once again: a slight early wakeup isn't an issue That's your opinion, but I disagree. Please open a new issue with a patch, or reopen at least this issue because it is now closed. I already spent to much time on this issue. Buildbots are now happy, I don't want to change this again. So, to sum up: - you write a fragile and unelegant patch without a good reason - you commit it without review - you're asked several times to provide an example of the problems your patch is supposed to solve, but don't give any - you don't take into account the fact that all proven and successful event loops work just fine without a similar patch - you insist, and won't neither back your claims by examples, nor revert your patch Fine, keep it this way, but I'm done with this, I've lost enough time. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20311 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20475] pystone.py in 3.4 still uses time.clock(), even though it's marked as deprecated since 3.3
Paul Sokolovsky added the comment: The problem with pystone is that such tool is used to compare performances between different versions of Python. That's why I just propose to switch it to time.time(), which surely is available on each and every Python version and implementation. If there's a concern that some implementation may have only 1-second precision, then: 1) well, pystone has limits to its scientificity, it's more like quick-run-anywhere, there's pybench for real testing (it's maintained and supported I hope); 2) number of iteratations can be bumped from 50K to 200K-500K. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20475 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com