[issue15896] Sporadic EINVAL in nonblocking pipe os.read when forked child fails on Mac OS
Ronald Oussoren added the comment: The workaround should not be implemented in os.read because it is a very thin wrapper around the system call and should stay that way. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15896 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15967] Slaves don't seem to clean up their /tmp mess if a step fails.
Chris Jerdonek added the comment: Personally I think the best solution is to have the test framework allocate a single test directory This is partially done. See here: http://hg.python.org/cpython/file/19c74cadea95/Lib/test/regrtest.py#l1810 # Run the tests in a context manager that temporary changes the CWD to a # temporary and writable directory. regrtest sets things up such that the current working directory is supposed to be this temp directory (constructed from _make_temp_dir_for_build()). But the tests adhere to this only weakly. Many or most tests create their own temp directory rather than relying on the caller having set the current working directory to a temp directory. If the tests used a common API, we could control this behavior globally. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15967 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15896] Sporadic EINVAL in nonblocking pipe os.read when forked child fails on Mac OS
Vitaly added the comment: The workaround should not be implemented in os.read because it is a very thin wrapper around the system call and should stay that way. Although this issue was initially filed as Sporadic EINVAL in nonblocking pipe os.read when forked child fails on Mac OS, the subsequent investigation revealed that this has nothing to do with a forked child failing. Rather, it's a bug in the read() syscall on Mac OS X. What would be a more appropriate place to work around this read() syscall bug than os.read? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15896 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15896] Sporadic EINVAL in nonblocking pipe os.read when forked child fails on Mac OS
Ronald Oussoren added the comment: How can you work around it in os.read, without knowing anything about what the file descriptor represents? Just triggering on getting on EINVAL error when calling read might trigger other problems and might even be a valid result for some file descriptors (for example for custom file systems or device files). And what kind of workaround do you propose? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15896 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14783] Make int() and str() docstrings correct
Serhiy Storchaka added the comment: +.. function:: int(number=0) First argument is named x. int(number=42) Traceback (most recent call last): File stdin, line 1, in module TypeError: 'number' is an invalid keyword argument for this function int(x=42) 42 + int(string, base=10) Here can be not only string, but bytes or bytearray. int('42', 6) 26 int(b'42', 6) 26 int(bytearray(b'42'), 6) 26 -- nosy: +storchaka ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14783 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6471] errno and strerror attributes incorrectly set on socket errors wrapped by urllib
Ezio Melotti added the comment: I seem to remember writing code that fished the wrapped error out using one of those attributrs... That would be err.reason: from urllib.request import urlopen try: urlopen('http://www.pythonfoobarbaz.org') except Exception as exc: print('err:', err) print('repr(err):', repr(err)) print('err.reason:', err.reason) print('repr(err.reason):', repr(err.reason)) prints: err: urlopen error [Errno -2] Name or service not known repr(err): URLError(gaierror(-2, 'Name or service not known'),) err.reason: [Errno -2] Name or service not known repr(err.reason): gaierror(-2, 'Name or service not known') -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6471 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6471] errno and strerror attributes incorrectly set on socket errors wrapped by urllib
Changes by Chris Jerdonek chris.jerdo...@gmail.com: -- nosy: +cjerdonek ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6471 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14783] Make int() and str() docstrings correct
Ezio Melotti added the comment: First argument is named x. Sometimes the doc uses better names to improve clarity when the argument is not supposed to be called as keyword arg. Here can be not only string, but bytes or bytearray. The same applies here. string is also used in the error message (int() can't convert non-string with explicit base). If bytes/bytearrays are accepted too it could be mentioned later in the prose. Otherwise we could use x for both, but the distinction would be less clear. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14783 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11454] email.message import time
Serhiy Storchaka added the comment: If I change the regex to _has_surrogates = re.compile('[\udc80-\udcff]').search, the tests still pass but there's no improvement on startup time (note: the previous regex was matching all the surrogates in this range too, however I'm not sure how well this is tested). What about _has_surrogates = re.compile('[^\udc80-\udcff]*\Z').match ? -- nosy: +storchaka ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11454 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11454] email.message import time
Ezio Melotti added the comment: What about _has_surrogates = re.compile('[^\udc80-\udcff]*\Z').match ? The runtime is a bit slower than re.compile('[\udc80-\udcff]').search, but otherwise it's faster than all the other alternatives. I haven't checked the startup-time, but I suspect it won't be better -- maybe even worse. -- Added file: http://bugs.python.org/file27223/issue11454_surr1.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11454 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11454] email.message import time
Serhiy Storchaka added the comment: I haven't checked the startup-time, but I suspect it won't be better -- maybe even worse. I suppose it will be much better. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11454 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11454] email.message import time
Serhiy Storchaka added the comment: Startup-time: $ ./python -m timeit -s 'import re' 're.compile(([^\ud800-\udbff]|\A)[\udc00-\udfff]([^\udc00-\udfff]|\Z)).search; re.purge()' 100 loops, best of 3: 4.16 msec per loop $ ./python -m timeit -s 'import re' 're.purge()' 're.compile([\udc80-\udcff]).search' 100 loops, best of 3: 5.72 msec per loop $ ./python -m timeit 'h=lambda s, p=set(map(chr, range(0xDC80, 0xDCFF+1))): any(c in p for c in s)' 1 loops, best of 3: 60.5 usec per loop $ ./python -m timeit -s 'import re' 're.purge()' 're.compile((?![^\udc80-\udcff])).search' 1000 loops, best of 3: 401 usec per loop $ ./python -m timeit -s 'import re' 're.purge()' 're.compile([^\udc80-\udcff]*\Z).match' 1000 loops, best of 3: 427 usec per loop Runtime: $ ./python -m timeit -s 'import re; h=re.compile(([^\ud800-\udbff]|\A)[\udc00-\udfff]([^\udc00-\udfff]|\Z)).search; s = A*1000' 'h(s)' 1000 loops, best of 3: 245 usec per loop $ ./python -m timeit -s 'import re; h=re.compile([\udc80-\udcff]).search; s = A*1000' 'h(s)' 1 loops, best of 3: 30.1 usec per loop $ ./python -m timeit -s 'h=lambda s, p=set(map(chr, range(0xDC80, 0xDCFF+1))): any(c in p for c in s); s = A*1000' 'h(s)' 1 loops, best of 3: 164 usec per loop $ ./python -m timeit -s 'import re; h=re.compile((?![^\udc80-\udcff])).search; s = A*1000' 'h(s)' 1 loops, best of 3: 98.3 usec per loop $ ./python -m timeit -s 'import re; h=re.compile([^\udc80-\udcff]*\Z).match; s = A*1000' 'h(s)' 1 loops, best of 3: 34.6 usec per loop -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11454 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11664] Add patch method to unittest.TestCase
Michael Foord added the comment: It maybe that patch.object is a more natural interface to the small sample of people commenting here, in which case great - that's what it's there for. However in common usage patch is used around two orders of magnitude more. I've seen large codebases with hundreds of uses of patch and only a handful of uses of patch.object. To support the *minor* use case and not the major use case in TestCase would be an inanity. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11664 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15946] Windows 8 x64 - IO-Error
Martin v. Löwis added the comment: I think it should be possible to add a wait=False parameter to rmtree which makes it block until the directory is gone away. This could be similar to the test.support feature added in #15496. For compatibility, such a flag should default to False, and users need to be aware that this may block indefinitely. I'd be opposed to specifying a timeout - users who need that can use the non-blocking version, and then loop themselves (or we expose a separate wait function with a timeout). Of course, such a feature could not be added to 2.7. -- nosy: +loewis ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15946 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11454] email.message import time
Serhiy Storchaka added the comment: Faster set-version: $ ./python -m timeit -s 'h=lambda s, hn=set(map(chr, range(0xDC80, 0xDD00))).isdisjoint: not hn(s); s = A*1000' 'h(s)' 1 loops, best of 3: 43.8 usec per loop -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11454 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15276] unicode format does not really work in Python 2.x
Martin v. Löwis added the comment: What do you think? [Even though I wasn't asked] I think we may need to close the issue as won't fix. Depending on the exact change propsosed, it may be that the return type for existing operations might change, which shouldn't be done in a bug fix release. People running into this issue should port to Python 3 (IMO). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15276 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15964] SyntaxError in asdl when building 2.7 with system Python 3
Martin v. Löwis added the comment: The case that python is a Python 3 binary is not a supported installation (see PEP 394). asdl_c.py works on both 2.x and 3.x unmodified in the 3.x branch, however, backporting this to 2.7 would be a new feature (support for building on systems where python is Python 3). The proper work-around is to make touch after a hg update to bring the files in the right order. #15923 is really a separate issue since it complains about an actual bug in asdl_c.py. So I propose to close this as won't fix. -- nosy: +loewis ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15964 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15966] concurrent.futures: Executor.submit keyword arguments may not be called 'fn' (or 'self')
Mark Dickinson added the comment: Ah, I added the wrong Brian to the nosy. Sorry, Brian C. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15966 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15971] Sporadic failure in test_dump_tracebacks_later_file (test_faulthandler)
STINNER Victor added the comment: Code of the failing test: import faulthandler import time def func(timeout, repeat, cancel, file, loops): for loop in range(loops): faulthandler.dump_tracebacks_later(timeout, repeat=repeat, file=file) if cancel: faulthandler.cancel_dump_tracebacks_later() time.sleep(timeout * 5) # line 9 faulthandler.cancel_dump_tracebacks_later() # line 10 timeout = {timeout} repeat = {repeat} cancel = {cancel} loops = {loops} if {has_filename}: file = open({filename}, wb) else: file = None func(timeout, repeat, cancel, file, loops) if file is not None: file.close() If the test fails at line 10: it means that it failed to dump the traceback in 2.5 seconds, whereas the traceback must be dumped after a timeout of 0.5 second. Do you know if the system load of this particular buildbot is high? It would be nice to have the system load in the output of the buildbot. We might change the timeout, but it is already long. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15971 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6471] errno and strerror attributes incorrectly set on socket errors wrapped by urllib
R. David Murray added the comment: Ah, of course. I should have reread the whole issue :) The backward compatibility is the big concern here. Regardless of what we do about that, we should at least fix this in 3.4. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6471 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15415] Add temp_dir() and change_cwd() to test.support
Changes by Brett Cannon br...@python.org: -- nosy: +brett.cannon ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15415 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11664] Add patch method to unittest.TestCase
Éric Araujo added the comment: A data point: at work I follow Pyramid testing guidelines which tell you not to import code under test at module level, but in your test functions, so that if you have an error your tests do start and you see the error under the test method. This means that I use mock.patch and not mock.patch.object, as my modules are not imported. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11664 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15972] wrong error message for os.path.getsize
New submission from John Taylor: import os.path a = [ r'c:\Windows\notepad.exe' ] print( os.path.getsize(a) ) Under Python 3.2.3, this error message is returned: File c:\python32\lib\genericpath.py, line 49, in getsize return os.stat(filename).st_size TypeError: Can't convert 'list' object to str implicitly Under Python 3.3.0rc2, this error message is returned: File c:\Python33\lib\genericpath.py, line 49, in getsize return os.stat(filename).st_size TypeError: an integer is required I feel like the 3.2.3 behavior is more accurate and would like to propose that the 3.3 error message says something about a list instead of an integer. -- components: Extension Modules messages: 170726 nosy: jftuga priority: normal severity: normal status: open title: wrong error message for os.path.getsize type: behavior versions: Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15972 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15972] wrong error message for os.path.getsize
Christian Heimes added the comment: Linux: os.stat([]) Traceback (most recent call last): File stdin, line 1, in module FileNotFoundError: [Errno 2] No such file or directory: '' [60996 refs] os.stat([None]) Traceback (most recent call last): File stdin, line 1, in module TypeError: an integer is required [60993 refs] -- keywords: +3.3regression nosy: +christian.heimes ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15972 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15964] SyntaxError in asdl when building 2.7 with system Python 3
Chris Jerdonek added the comment: The case that python is a Python 3 binary is not a supported installation Just to clarify, in the original scenario, python did not refer to anything. From the original comment: $ python No such file or directory (python2 and python3 did refer to the respective versions.) The proper work-around is to make touch after a hg update to bring the files in the right order. I had tried this in the 2.7 branch and got: $ make touch make: *** No rule to make target `touch'. Stop. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15964 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15964] SyntaxError in asdl when building 2.7 with system Python 3
Christian Heimes added the comment: $ make touch make: *** No rule to make target `touch'. Stop. Martin meant: touch Include/Python-ast.h Python/Python-ast.c -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15964 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15964] SyntaxError in asdl when building 2.7 with system Python 3
Chris Jerdonek added the comment: Yes, that works. Rather than closing this as won't fix, however, I would suggest that we document the workaround in the devguide. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15964 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11454] email.message import time
Changes by Ezio Melotti ezio.melo...@gmail.com: Removed file: http://bugs.python.org/file27223/issue11454_surr1.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11454 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11454] email.message import time
Changes by Ezio Melotti ezio.melo...@gmail.com: Removed file: http://bugs.python.org/file27203/issue11454_surr1.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11454 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15896] Sporadic EINVAL in nonblocking pipe os.read when forked child fails on Mac OS
Vitaly added the comment: And what kind of workaround do you propose? [os.read(fd, buffersize)] I am thinking about these options: Option 1: Fix breakages as they are discovered at higher level (above os.read) as needed in places where usage semantics are known, and address the issue via errata documentation (i.e., On Mac OS X, don't make individual pipe read requests that would result in os.read() buffersize arg being above 127KB on non-blocking pipes.); should also check if the same issue occurs with sockets (e.g., socket.socketpair() instead of os.pipe()) to make the errata more complete. This may be perfectly acceptable and how things have worked for a long time. Option 2: Implement a work-around in the lowest common denominator wrapper function, so that anything in Python that needs to call read() and could benefit from this work-around, would call that wrapper instead of read(). The read() work-around might go something like this in *pseudocode*: if running_on_darwin and buffersize 127KB: # fix up buffer size to work around a Mac OS x bug... if stat.S_ISFIFO(os.fstat(fd).st_mode): buffersize = 127KB Then do whatever else the read function is supposed to do. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15896 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15973] Segmentation fault on timezone comparison
New submission from Lance Helsten: In the 3.2.3 interpreter execute the following line: `None == datetime.timezone(datetime.timedelta())` The interpreter will crash with a `Segmentation fault: 11`. -- assignee: ronaldoussoren components: Macintosh files: CoreDump.txt messages: 170732 nosy: lanhel, ronaldoussoren priority: normal severity: normal status: open title: Segmentation fault on timezone comparison type: crash versions: Python 3.2 Added file: http://bugs.python.org/file27224/CoreDump.txt ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15973 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15974] Optional compact and colored output for regrest
New submission from Brett Cannon: It would be nice to have something like sphinx's build output where the output is all kept on a single line except for failures. The color would help when scrolling through current output looking for failures. Currently I just look until the failure count switches, but I can spot color more quickly and easily. The reason for the compact output is that I simply don't typically care about passed tests, so why keep it visible? It also helps with noticing tests failures if those are the only tests that are kept in the terminal while the suite is running (obviously the output summary is still there). This also suggests having an option to write out to a file the test results to make it easier to see the exact test execution order (and if passed tests are commented out then it's easier to pass the file to --fromfile to re-run the fail tests). -- components: Tests messages: 170733 nosy: brett.cannon priority: low severity: normal stage: needs patch status: open title: Optional compact and colored output for regrest type: enhancement versions: Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15974 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15973] Segmentation fault on timezone comparison
Stefan Krah added the comment: Reproducible also on Linux with Python 3.3. -- components: +Extension Modules -Macintosh nosy: +belopolsky, skrah stage: - needs patch versions: +Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15973 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15974] Optional compact and colored output for regrest
Ezio Melotti added the comment: It would be nice to have something like sphinx's build output where the output is all kept on a single line except for failures. +1 I wanted the exact same thing for a long time but never had time to look at it. OTOH the more features are added to regrtest, the more complex it gets, and it's already fairly complex as it is. A better option might be to create a new unittest test runner, and then start switching regrtest to use more unittest bits (see #10967). That should allow us to select the runner we prefer, and that can also be available for regular unittests (there might even be something already). -- nosy: +ezio.melotti ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15974 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15973] Segmentation fault on timezone comparison
Changes by Alexander Belopolsky alexander.belopol...@gmail.com: -- assignee: ronaldoussoren - belopolsky ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15973 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15973] Segmentation fault on timezone comparison
John Taylor added the comment: Crashes Python 3.2.3 and Python 3.3.0rc2 on Windows 7 as well. -- nosy: +jftuga ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15973 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15975] Allow multiplying timedelta by Decimal
New submission from Ram Rachum: Please allow multiplying timedelta by a Decimal: Python 3.3.0a1 (default, Mar 4 2012, 17:27:59) [MSC v.1500 32 bit (Intel)] on win32 Type help, copyright, credits or license for more information. import datetime import decimal decimal.Decimal('0.1')*datetime.timedelta(seconds=3) Traceback (most recent call last): File stdin, line 1, in module TypeError: unsupported operand type(s) for *: 'Decimal' and 'datetime.timedelta' -- components: Library (Lib) messages: 170737 nosy: cool-RR priority: normal severity: normal status: open title: Allow multiplying timedelta by Decimal type: behavior versions: Python 3.3, Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15975 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15974] Optional compact and colored output for regrest
Antoine Pitrou added the comment: I also think it would be better to refactor regrtest before adding this kind of complication. -- nosy: +pitrou ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15974 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15975] Allow multiplying timedelta by Decimal
Mark Dickinson added the comment: Do you have a particular use-case in mind? Is there a reason that td * 0.1 or td / 10.0 aren't good enough? -- nosy: +mark.dickinson ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15975 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15975] Allow multiplying timedelta by Decimal
Ram Rachum added the comment: This is for cases where I already have the number as a Decimal. Asking me to convert it to `float` myself is annoying. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15975 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15973] Segmentation fault on timezone comparison
Alexander Belopolsky added the comment: I cannot reproduce on a Mac with py3k tip. Python 3.3.0rc2+ (default:19c74cadea95, Sep 19 2012, 14:39:07) [GCC 4.2.1 Compatible Apple Clang 3.1 (tags/Apple/clang-318.0.61)] on darwin Type help, copyright, credits or license for more information. import datetime None == datetime.timezone(datetime.timedelta()) False Can anyone reproduce in a debug build and post a stack trace? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15973 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15975] Allow multiplying timedelta by Decimal
Changes by Mark Dickinson dicki...@gmail.com: -- nosy: +belopolsky ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15975 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15975] Allow multiplying timedelta by Decimal
Alexander Belopolsky added the comment: This is similar to issue 14262. If we decide that timedelta should play nice with Decimal, I would like to consider all related features. -- versions: -Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15975 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15975] Allow multiplying timedelta by Decimal
Mark Dickinson added the comment: Asking me to convert it to `float` myself is annoying. Well, it's just a call to 'float', right? On the other side, we're looking at significant extra code to implement Decimal * timedelta, so there needs to be a good reason to add it. (And there's feature-creep involved, too; once we've got Decimal * timedelta, there will probably also be requests for timedelta / Decimal, and possibly timedelta / timedelta - Decimal too). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15975 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15975] Allow multiplying timedelta by Decimal
Mark Dickinson added the comment: Agreed; +1 on folding this into issue 14262. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15975 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14262] Allow using decimals as arguments to `timedelta`
Changes by Mark Dickinson dicki...@gmail.com: -- versions: +Python 3.4 -Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14262 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15975] Allow multiplying timedelta by Decimal
Alexander Belopolsky added the comment: In fact, this is a near-duplicate of #14262 becaus instead of decimal.Decimal('0.1')*datetime.timedelta(seconds=3) one can always write datetime.timedelta(seconds=decimal.Decimal('0.1')*3) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15975 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14262] Allow using decimals as arguments to `timedelta`
Mark Dickinson added the comment: (1) timedelta(decimal) does no loose precision over the entire range of timedelta and rounding is documented; Agreed that this should be a requirement. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14262 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15975] Allow multiplying timedelta by Decimal
Ram Rachum added the comment: +1 on folding this into issue 14262. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15975 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15975] Allow multiplying timedelta by Decimal
Changes by Mark Dickinson dicki...@gmail.com: -- resolution: - duplicate status: open - closed superseder: - Allow using decimals as arguments to `timedelta` ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15975 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14262] Allow using decimals as arguments to `timedelta`
Alexander Belopolsky added the comment: Mark wrote in his comment on issue 15975: we're looking at significant extra code to implement Decimal * timedelta Not necessarily. I will only support adding this feature if it can be done without making datetime know about Decimal. If we can agree on a lossless protocol to communicate floating pointing numbers of different base (or even more generally rational numbers), datetime module can support this protocol and allow all kinds of numbers in its constructors without much extra code. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14262 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14262] Allow using decimals as arguments to `timedelta`
Mark Dickinson added the comment: @Ram Rachum: out of curiosity, where are your Decimal objects coming from in the first place? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14262 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14262] Allow using decimals as arguments to `timedelta`
Mark Dickinson added the comment: If we can agree on a lossless protocol to communicate floating pointing numbers of different base What sort of thing did you have in mind? This is sounding like a PEP-level proposal. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14262 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14262] Allow using decimals as arguments to `timedelta`
Ram Rachum added the comment: @mark.dickinson: Many different sources. One example is decimal fields on Django, used for dollar amounts. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14262 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15896] Sporadic EINVAL in nonblocking pipe os.read when forked child fails on Mac OS
Ned Deily added the comment: Out of curiosity, has anyone checked whether this is also an issue with any of the supported BSD's? There have been other issues which were detected first on OS X but turned out to be more general BSD vs Linux differences, rather than OS X bugs. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15896 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14262] Allow using decimals as arguments to `timedelta`
Alexander Belopolsky added the comment: On Wed, Sep 19, 2012 at 3:09 PM, Ram Rachum rep...@bugs.python.org wrote: One example is decimal fields on Django, used for dollar amounts. .. and since time is money and money is time we should support easy conversion between the two. :-) -- nosy: +Alexander.Belopolsky ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14262 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14262] Allow using decimals as arguments to `timedelta`
Ram Rachum added the comment: I hope this was intended as a joke. If this was an actual criticism, let me know so I could explain why it makes sense. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14262 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15974] Optional compact and colored output for regrest
Brett Cannon added the comment: I totally agree, I just wanted this in the tracker as a long-term goal to have. I have made this a dependency on issue #10967 which is tracking moving regrtest over unittest as much as possible. -- dependencies: +move regrtest over to using more unittest infrastructure ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15974 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15973] Segmentation fault on timezone comparison
Stefan Krah added the comment: The segfault does not occur in a debug build. The stack trace suggests that timezone_richcompare() accesses other-offset of the None object: (gdb) f 2 #2 0x0041d4e9 in do_richcompare (v=None, w=datetime.timezone at remote 0x76688ab0, op=value optimized out) at Objects/object.c:563 563 res = (*f)(w, v, _Py_SwappedOp[op]); (gdb) f 1 #1 timezone_richcompare (self=0x76688ab0, other=value optimized out, op=2) at /home/stefan/pydev/cpython-commit/Modules/_datetimemodule.c:3218 3218return delta_richcompare(self-offset, other-offset, op); (gdb) l 3213timezone_richcompare(PyDateTime_TimeZone *self, 3214 PyDateTime_TimeZone *other, int op) 3215{ 3216if (op != Py_EQ op != Py_NE) 3217Py_RETURN_NOTIMPLEMENTED; 3218return delta_richcompare(self-offset, other-offset, op); 3219} 3220 3221static Py_hash_t 3222timezone_hash(PyDateTime_TimeZone *self) (gdb) f 0 #0 0x75d850cf in delta_richcompare (self=0x76688ab0, other=value optimized out, op=2) at /home/stefan/pydev/cpython-commit/Modules/_datetimemodule.c:1823 1823if (PyDelta_Check(other)) { -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15973 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15973] Segmentation fault on timezone comparison
R. David Murray added the comment: On linux it segfaults for me in the debug interpreter. On default tip. -- nosy: +r.david.murray ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15973 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14262] Allow using decimals as arguments to `timedelta`
Alexander Belopolsky added the comment: On Wed, Sep 19, 2012 at 3:24 PM, Ram Rachum rep...@bugs.python.org wrote: I hope this was intended as a joke. If this was an actual criticism, let me know so I could explain why it makes sense. It was both. Yes, any use cases will be helpful. Timedelta is already a decimal with six fractional digits, so it is natural to desire having direct Decimal to timedelta conversion, but without important use-case this feature will be hard to sell. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14262 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15949] docs.python.org not getting updated
Chris Jerdonek added the comment: It has been 8 days since the last update. -- priority: normal - high ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15949 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15976] Inconsistent behavior of search_for_exec_prefix() results in startup failure in certain cases
New submission from Evangelos Foutras: On Arch Linux /lib is a symbolic link to /usr/lib. When the Python interpreter is provided with an argv[0] of e.g. '/python2.7' and the current working directory is /, it'll fail to start with the following error: IOError: invalid Python installation: unable to open //include/python2.7/pyconfig.h (No such file or directory) From what I understand, what is happening inside Modules/getpath.c is: 1) search_for_exec_prefix() is given an empty `argv0_path` 2) PYTHONHOME is not set, and we're not in a build directory, so step three is executed: * Step 3. Try to find prefix and exec_prefix relative to argv0_path, * backtracking up the path until it is exhausted. This is the most common * step to succeed. Note that if prefix and exec_prefix are different, * exec_prefix is more likely to be found; however if exec_prefix is a * subdirectory of prefix, both will be found. 3) copy_absolute() sets `exec_prefix` to '/' 4) 'lib/python2.7' gets appended to `exec_prefix` using joinpath() 5) 'lib-dynload' gets appended to `exec_prefix` using joinpath() 6) '/lib/python2.7/lib-dynload' exists and the function returns 1 (success) 7) control is returned to calculate_path() which later reduces `exec_prefix` to '/' During further initialization, sysconfig.py tries to open pyconfig.h, whose path is calculated as {exec_prefix}/include/python2.7/pyconfig.h; thus ending up with the nonexistent path //include/python2.7/pyconfig.h. The correct exec_prefix would be /usr. Moreover, if argv[0] and/or the current working directory are one level deeper (or more), `exec_prefix` will not be reduced to '/' and search_for_exec_prefix() will proceed to step four: * Step 4. Search the directories pointed to by the preprocessor variables * PREFIX and EXEC_PREFIX. These are supplied by the Makefile but can be * passed in as options to the configure script. i.e.: If search_for_exec_prefix() is passed an `argv0_path` with the value '/mnt', step three will only check '/mnt' but not '/', because '/mnt' will be reduced to '' and the `while (exec_prefix[0])` condition will be false. I see two problems with the behavior I describe above: 1) Step three will skip checking the root directory (/) if argv[0] or the current working directory are one or more levels below / (in other words, not directly under /). Its behavior in this regard is inconsistent. 2) When argv[0] is e.g. '/python2.7' and the current working directory is /, it'll use '/' as the exec_prefix and fail to start. The /lib - /usr/lib symbolic link should get dereferenced and not used as is. I'm not sure how this should be fixed, so I only tried to present the issue with as many details as I could. If something is unclear, let me know. Lastly, search_for_prefix() has very similar code, so any fix will have to be applied there too. (There is also a downstream bug report @ https://bugs.archlinux.org/task/30812.) -- components: Interpreter Core messages: 170760 nosy: foutrelis priority: normal severity: normal status: open title: Inconsistent behavior of search_for_exec_prefix() results in startup failure in certain cases type: crash versions: Python 2.7, Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15976 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11454] email.message import time
Ezio Melotti added the comment: Attached new benchmark file. Results: Testing runtime of the _has_surrogates functions Generating chars... Generating samples... 1.61 - re.compile(current_regex).search 0.24 - re.compile(short_regex).search 15.13 - return any(c in surrogates for c in s) 10.21 - for c in s: if c in surrogates: return True 0.85 - return re.search(short_regex, s) 0.83 - functools.partial(re.search, short_regex) 20.86 - for c in map(ord, s): if c in range(0xDC80, 0xDCFF+1): return True 19.68 - for c in map(ord, s): if 0xDC80 = c = 0xDCFF: return True 0.28 - re.compile('[^\udc80-\udcff]*\Z').match 7.00 - return not set(map(chr, range(0xDC80, 0xDCFF+1))).isdisjoint(s) Testing startup time 0.57 - r = re.compile('[\udc80-\udcff]').search 0.59 - r = re.compile('[^\udc80-\udcff]*\Z').match 199.79 - r = re.compile('[\udc80-\udcff]').search; purge() 22.62 - r = re.compile('[^\udc80-\udcff]*\Z').match; purge() 1.12 - r = pickle.loads(p) -- Added file: http://bugs.python.org/file27225/issue11454_benchmarks.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11454 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11454] email.message import time
R. David Murray added the comment: So by your measurements the short search is the clear winner? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11454 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11454] email.message import time
Ezio Melotti added the comment: Yes, however it has a startup cost that the function that returns re.search(short_regex, s) and the one with functool.partial don't have, because with these the compilation happens at the first call. If we use one of these two, the startup time will be reduced a lot, and the runtime will be ~2x faster. If we use re.compile(short_regex).search the startup time won't be reduced as much, but the runtime will be ~8x faster. Given that here we are trying to reduce the startup time and not the runtime, I think using one of those two functions is better. Another possible solution to improve the startup time is trying to optimize _optimize_unicode -- not sure how much can be done there though. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11454 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15896] Sporadic EINVAL in nonblocking pipe os.read when forked child fails on Mac OS
Charles-François Natali added the comment: Option 1: Fix breakages as they are discovered at higher level (above os.read) as needed in places where usage semantics are known, and address the issue via errata documentation (i.e., On Mac OS X, don't make individual pipe read requests that would result in os.read() buffersize arg being above 127KB on non-blocking pipes.); should also check if the same issue occurs with sockets (e.g., socket.socketpair() instead of os.pipe()) to make the errata more complete. This may be perfectly acceptable and how things have worked for a long time. Implement a work-around in the lowest common denominator wrapper function, so that anything in Python that needs to call read() and could benefit from this work-around, would call that wrapper instead of read(). The read() work-around might go something like this in *pseudocode*: It's not Python's job to workaround stupid platform bugs, or document them: that would lead to unmanagable code or unmaintanable documentation. This particular issue will get fixed as part of http://bugs.python.org/issue15918, and I'm -10 against adding an hack to posix.read(). So I'd suggest closing this, and urge people to complain to the OS-X folks. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15896 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11454] email.message import time
R. David Murray added the comment: This issue may be about reducing the startup time, but this function is a hot spot in the email package so I would prefer to sacrifice startup time optimization for an increase in speed. However, given the improvements to import locking in 3.3, what about a self replacing function? def _has_surrogates(s): import email.utils f = re.compile('[\udc80-\udcff]').search email.utils._has_surrogates = f return f(s) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11454 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15896] Sporadic EINVAL in nonblocking pipe os.read when forked child fails on Mac OS
Vitaly added the comment: It's not Python's job to workaround stupid platform bugs... So I'd suggest closing this, and urge people to complain to the OS-X folks After digesting the postings, I've come around to this point of view as well, so closing as rejected. And, as mentioned earlier, I filed the issue on https://bugreport.apple.com as Problem ID: 12274650. -- resolution: - rejected ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15896 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11454] email.message import time
Ezio Melotti added the comment: That might work. To avoid the overhead of the cache lookup I was thinking about something like regex = None def _has_surrogates(s): global regex if regex is None: regex = re.compile(short_regex) return regex.search(s) but I have discarded it because it's not very pretty and still has the overhead of the function and an additional if. Your version solves both the problems in a more elegant way. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11454 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15896] Sporadic EINVAL in nonblocking pipe os.read when forked child fails on Mac OS
Changes by Vitaly vitaly.krugl.nume...@gmail.com: -- status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15896 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11454] email.message import time
R. David Murray added the comment: It passed the email test suite. Patch attached. -- Added file: http://bugs.python.org/file27226/email_import_speedup.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11454 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14262] Allow using decimals as arguments to `timedelta`
Ram Rachum added the comment: I can think of millions of use cases. Here's a random one out of those millions: A client is entitled to X hours of service a month. We grant him a promotion where he is allowed 15% more than x, i.e. 1.15*x. But that number, 1.15, is stored in a Django decimal field. We try to multiply 1.15 by the timedelta X and it fails. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14262 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11454] email.message import time
Ezio Melotti added the comment: It would be better to add/improve the _has_surrogates tests before committing. The patch I attached is also still valid if you want a further speed up improvement. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11454 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14262] Allow using decimals as arguments to `timedelta`
Alexander Belopolsky added the comment: On Wed, Sep 19, 2012 at 4:32 PM, Ram Rachum rep...@bugs.python.org wrote: But that number, 1.15, is stored in a Django decimal field. My criticism was towards the idea that one may need to multiply timedelta by a dollar amount or convert a dollar amount to a timedelta. Storing dollar amounts is an important use case for Decimal and there are several reasons why Decimal is a better choice than float for this. On the other hand, I don't see why use of Decimal would be required in your example. Do you have any real world use cases where Decimal is clearly preferred over float and there is a need to multiply Decimals by time deltas? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14262 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11454] email.message import time
Serhiy Storchaka added the comment: def _has_surrogates(s): try: s.encode() return False except UnicodeEncodeError: return True Results: 0.26 - re.compile(short_regex).search 0.06 - try encode -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11454 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14262] Allow using decimals as arguments to `timedelta`
Ram Rachum added the comment: In the example I gave, Decimal is clearly preferred over float. Why would we use float to represent the ratio of the bonus to the client? Why would we risk imprecision there when Decimal provides us with perfect precision? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14262 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15977] Memory leak in _ssl.c
New submission from Daniel Sommermann: I noticed that the function _set_npn_protocols() has the following line: self-npn_protocols = PyMem_Malloc(protos.len); There is no check to see if self-npn_protocols is already allocated. Thus, multiple calls to _set_npn_protocols() will leak memory. There should be a check to see if it is non-null and free the memory pointed to by self-npn_protocols before the malloc unless I am missing something. -- components: IO messages: 170774 nosy: Daniel.Sommermann, pitrou priority: normal severity: normal status: open title: Memory leak in _ssl.c versions: Python 3.3, Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15977 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10967] move regrtest over to using more unittest infrastructure
Changes by Chris Jerdonek chris.jerdo...@gmail.com: -- nosy: +cjerdonek ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10967 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10967] move regrtest over to using more unittest infrastructure
Chris Jerdonek added the comment: One important piece is that regrtest currently has no tests (e.g. there is no test_regrtest.py), so changing it must be done more carefully. How do people feel about new (or newly modified) regrtest classes and functions going into a different fully-tested module with its own test_* file. Currently, regrtest is a mixture of definitions and running code, so I would be leery of adding test_regrtest. This could also be done by making regrtest a package, so that regrtest-related modules would be in a single directory. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10967 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14262] Allow using decimals as arguments to `timedelta`
Alexander Belopolsky added the comment: On Sep 19, 2012, at 5:36 PM, Ram Rachum rep...@bugs.python.org wrote: Why would we use float to represent the ratio of the bonus to the client? Because float is the builtin type that Python provides to represent such quantities. Why would we risk imprecision there when Decimal provides us with perfect precision? Python float is a much simpler and more efficient type than Decimal. One should have a really good reason to introduce Decimal in the program. In case of money, Decimal provides a *lower* precision alternative to float together with the control over rounding direction. This is important in applications where fractions of a penny have to be dealt with in very precise manner. In your application, float is a perfectly good type to represent 15% bonus. Even if your customers insist on microsecond precision, float is good enough and timedelta resolution will prevent you from supporting higher precision anyways. As I mentioned before, I would be happy to see greater interoperability between numerical types in Python and interoperability between timedelta and Decimal may come as a side benefit of that effort. However, I don't find your use case to be compelling enough to either justify special case code or to motivate a more general effort. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14262 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15888] ipaddress doctest examples have some errors
Chris Jerdonek added the comment: Attaching an updated patch that does not render the import statements in the final HTML, so that it renders the same as before. -- Added file: http://bugs.python.org/file27227/issue-15888-2.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15888 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15276] unicode format does not really work in Python 2.x
Chris Jerdonek added the comment: If we don't fix this (I'm leaning that way myself), I think we should somehow document the limitation. There are ways to acknowledge the limitation without getting into the specifics of this particular issue. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15276 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15977] Memory leak in _ssl.c
Christian Heimes added the comment: You are right. I did some testing and the function indeed leaks memory. The attached patch fixes the issue for me. -- keywords: +patch nosy: +christian.heimes stage: - patch review type: - resource usage Added file: http://bugs.python.org/file27228/npn_memfix.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15977 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15973] Segmentation fault on timezone comparison
Alexander Belopolsky added the comment: I think the following simple patch should do the trick. I'll add some tests and commit. Should this get in 3.3.0? diff -r 19c74cadea95 Modules/_datetimemodule.c --- a/Modules/_datetimemodule.c Wed Sep 19 08:25:01 2012 +0300 +++ b/Modules/_datetimemodule.c Wed Sep 19 21:42:51 2012 -0400 @@ -3215,6 +3215,11 @@ { if (op != Py_EQ op != Py_NE) Py_RETURN_NOTIMPLEMENTED; +if (Py_TYPE(other) != PyDateTime_TimeZoneType) + if (op == Py_EQ) + Py_RETURN_FALSE; + else + Py_RETURN_TRUE; return delta_richcompare(self-offset, other-offset, op); } -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15973 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15973] Segmentation fault on timezone comparison
Benjamin Peterson added the comment: Hopefully, there will be some more braces, though. :) -- nosy: +benjamin.peterson ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15973 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15978] asyncore: included batteries don't fit
New submission from chrysn: the asyncore module would be much more useful if it were well integrated in the standard library. in particular, it should be supported by: * subprocess * BaseHTTPServer / http.server (and thus, socketserver) * urllib2 / urllib, http.client * probably many other network libraries except smtpd, which already uses asyncore without widespread asyncore support, it is not possible to easily integrate different servers and services with each other; with asyncore support, it's just a matter of creating the objects and entering the main loop. (eg, a http server for controlling a serial device, with a telnet-like debugging interface). the socketserver even documents that it would like to have such a framework (Future work: [...] Standard framework for select-based multiplexing). it would be rather difficult to port in the generic case (as socketserver based code in general relies on blocking `read`s or `readline`s), but can be done in particular cases (i've ported SimpleHTTPServer, but it's a mess of monkey-patching). for subprocess, there's a bunch of recipies at [1]; pyserial (not standard library, but might as well become) can be ported quite easily [2]. [1] http://code.activestate.com/recipes/576957-asynchronous-subprocess-using-asyncore/ [2] http://sourceforge.net/tracker/?func=detailaid=3559321group_id=46487atid=446305 this issue touches several modules, so for practical implementation, it might be split up for the different individual fixes to come and track them. some of them will bring incompatible changes -- it's easy to get SimpleHTTPServer to a state where it can run unmodified inside asyncore, and emulate its external interfaces (serve_forever just being a wrapper to asyncore.loop), but hard to say if it will work with what people built atop of it. how can we find a roadmap for that? python already has batteries for nonblocking operation included -- let's just make sure they fit in the other gadgets! -- messages: 170782 nosy: chrysn priority: normal severity: normal status: open title: asyncore: included batteries don't fit ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15978 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15973] Segmentation fault on timezone comparison
Changes by Jesús Cea Avión j...@jcea.es: -- nosy: +jcea ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15973 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15977] Memory leak in _ssl.c
Changes by Jesús Cea Avión j...@jcea.es: -- nosy: +jcea stage: patch review - type: resource usage - ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15977 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15977] Memory leak in _ssl.c
Changes by Jesús Cea Avión j...@jcea.es: -- stage: - patch review type: - resource usage ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15977 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15973] Segmentation fault on timezone comparison
Jesús Cea Avión added the comment: What about datetime subclasses? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15973 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15978] asyncore: included batteries don't fit
Changes by Ezio Melotti ezio.melo...@gmail.com: -- components: +Library (Lib) nosy: +giampaolo.rodola, josiahcarlson, stutzbach type: - enhancement versions: +Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15978 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15973] Segmentation fault on timezone comparison
Alexander Belopolsky added the comment: What about datetime subclasses? Do you mean timezone subclasses? Timezone type is not subclassable, but we should probably support comparison with any tzinfo subclass. I'll add this logic, but arguably that would be a new feature. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15973 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15979] Improve timeit documentation
New submission from Ezio Melotti: The documentation of timeit can be improved in several ways: * it should start with a couple of short and comprehensible examples that show the basic usage from the command-line and from the code; * the 3 convenience functions should be moved before the class documentation (and their order inverted); * the methods in the class should be reordered to show the important one first; * more comprehensive (but still comprehensible) examples should be added at the end; * sh syntax highlight should be used for the command-line usage examples; * the note about Python 2.3 can be removed from 3.x docs; http://docs.python.org/dev/library/timeit.html -- assignee: docs@python components: Documentation messages: 170785 nosy: docs@python, ezio.melotti priority: normal severity: normal stage: needs patch status: open title: Improve timeit documentation type: enhancement versions: Python 2.7, Python 3.2, Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15979 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15979] Improve timeit documentation
Raymond Hettinger added the comment: +1 -- nosy: +rhettinger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15979 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14873] Windows devguide: clarification for build errors due to missing optional dependencies
Roundup Robot added the comment: New changeset a9f8a205fa9a by Ezio Melotti in branch 'default': #14873: add paragraph about building errors caused by missing dependencies on Windows. Patch by Chris Jerdonek, initial patch by Merlijn van Deen. http://hg.python.org/devguide/rev/a9f8a205fa9a -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14873 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14873] Windows devguide: clarification for build errors due to missing optional dependencies
Ezio Melotti added the comment: Fixed, thanks for the patches! -- assignee: - ezio.melotti resolution: - fixed stage: patch review - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14873 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14873] Windows devguide: clarification for build errors due to missing optional dependencies
Chris Jerdonek added the comment: Thanks, Ezio! -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14873 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15978] asyncore: included batteries don't fit
Giampaolo Rodola' added the comment: The proposal looks way too ambitious and vaguely defined to me to say the least. Integrating any async framework into another one which uses a blocking concurrency model is hard. If that async framework is asyncore is usually also a bad idea. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15978 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15939] make *.rst files in Doc/ parseable by doctest
Changes by Chris Jerdonek chris.jerdo...@gmail.com: -- nosy: +ezio.melotti ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15939 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com