[issue26680] Incorporating float.is_integer into the numeric tower and Decimal

2016-04-04 Thread Stefan Krah
Stefan Krah added the comment: I agree that Robert's "absurdity" argument was unfortunate and could be reversed: Many people would consider an (10).is_integer() method absurd. I'm also only moderately interested in OOP or classification in general, but we *do* have a n

[issue25928] Add Decimal.as_integer_ratio()

2016-04-05 Thread Stefan Krah
Stefan Krah added the comment: Raymond, you added your support in msg257097. I'm not very happy to spend my time implementing the feature and then rehashing everything after 3 months. -- nosy: +gvanrossum ___ Python tracker <http://bugs.py

[issue26680] Incorporating float.is_integer into the numeric tower and Decimal

2016-04-05 Thread Stefan Krah
Stefan Krah added the comment: On Tue, Apr 05, 2016 at 01:10:25PM +, Robert Smallshire wrote: > Were float to inherit from Rational, rather than Real ... This would break the Liskov substitution principle. -- ___ Python tracker &l

[issue26680] Incorporating float.is_integer into the numeric tower and Decimal

2016-04-05 Thread Stefan Krah
Stefan Krah added the comment: On Tue, Apr 05, 2016 at 02:20:19PM +, Robert Smallshire wrote: > >> Were float to inherit from Rational, rather than Real ... > > > This would break the Liskov substitution principle. > > How so? Rational extends Real with only nu

[issue26723] Add an option to skip _decimal module

2016-04-09 Thread Stefan Krah
Stefan Krah added the comment: I thought you solved the locale problem in #20305. So it still does not build? -- nosy: +skrah ___ Python tracker <http://bugs.python.org/issue26

[issue26723] Add an option to skip _decimal module

2016-04-09 Thread Stefan Krah
Stefan Krah added the comment: In any case: It is not uncommon that some C module does not build. You can disable modules in setup.py: # This global variable is used to hold the list of modules to be disabled. disabled_module_list = [] -- assignee: -> skrah resolut

[issue20210] Provide configure options to enable/disable Python modules and extensions

2016-04-10 Thread Stefan Krah
Stefan Krah added the comment: Normally I hate environment variables, but perhaps in this case PYTHON_DISABLE_MODULES="foo,bar,quux" would be sufficient? Setup.py already has the "disabled_module_list" variable, it's just a matter of setting this variable somehow. Thi

[issue26746] struct.pack(): trailing padding bytes on x64

2016-04-13 Thread Stefan Krah
New submission from Stefan Krah: On the x64 architecture gcc adds trailing padding bytes after the last struct member. NumPy does the same: >>> import numpy as np >>> >>> t = np.dtype([('x', 'u1'), ('y', 'u8'), ('z

[issue3132] implement PEP 3118 struct changes

2016-04-13 Thread Stefan Krah
Stefan Krah added the comment: Here's a grammar that roughly describes the subset that NumPy supports. As for implementing this in the struct module: There is a new data description language on the horizon: http://datashape.readthedocs.org/en/latest/ It does not have all the low-

[issue3132] implement PEP 3118 struct changes

2016-04-13 Thread Stefan Krah
Changes by Stefan Krah : -- versions: +Python 3.6 -Python 3.3 ___ Python tracker <http://bugs.python.org/issue3132> ___ ___ Python-bugs-list mailing list Unsub

[issue26746] struct.pack(): trailing padding bytes on x64

2016-04-13 Thread Stefan Krah
Stefan Krah added the comment: Thank you. So technically, in the above NumPy example the format string generated by NumPy would be considered incomplete if we assume struct syntax: >>> m = memoryview(x) >>> m.format 'T{B:x:xxxL:y:B:z:}' I find this "0L&q

[issue25702] Link Time Optimizations support for GCC and CLANG

2016-04-13 Thread Stefan Krah
Stefan Krah added the comment: LTO is not stable on all platforms (according to doko), and people don't want to wait for PGO to build when they just run ./configure && make. --with-pgo and --with-lto is fine. -- ___ Python t

[issue26359] CPython build options for out-of-the box performance

2016-04-14 Thread Stefan Krah
Stefan Krah added the comment: Not acceptable, I'm afraid. See #25702. I'm not sure why it is considered so bothersome to type --with-pgo and --with-lto for the rare case of a real production build. -- ___ Python tracker <http://bu

[issue25702] Link Time Optimizations support for GCC and CLANG

2016-04-14 Thread Stefan Krah
Stefan Krah added the comment: On Thu, Apr 14, 2016 at 08:39:20AM +, Alecsandru Patrascu wrote: > @Stefan and @Marc, you say that people don't want to wait for PGO to build > when running ./configure && make, but why? Even though many developers use > it, this mo

[issue25702] Link Time Optimizations support for GCC and CLANG

2016-04-14 Thread Stefan Krah
Stefan Krah added the comment: On Thu, Apr 14, 2016 at 08:55:25AM +, Stefan Krah wrote: > I use it all the time in development: ... where "it" refers to "./configure && make", not to PGO. -- ___ Python tracker <

[issue26743] Unable to import random with python2.7 on power pc based machine

2016-04-15 Thread Stefan Krah
Stefan Krah added the comment: An option would be to use the support of the probably commercial http://www.windriver.com/products/linux/ and ask them why they're still on Python 2.7.3. They'll also have gcc installed and can run the test case proposed in this issue. -- no

[issue26743] Unable to import random with python2.7 on power pc based machine

2016-04-15 Thread Stefan Krah
Stefan Krah added the comment: Also, I don't understand how the test suite could pass with these kinds of errors. Are you sure this is the Wind-River system Python? Did they run the test suite? -- ___ Python tracker <http://bugs.py

[issue26743] Unable to import random with python2.7 on power pc based machine

2016-04-15 Thread Stefan Krah
Stefan Krah added the comment: My conclusion is: The error in msg263292 should have been caught by the test suite. I'd ask the WindRiver support if they actually run the test suite before shipping the binaries. -- ___ Python tracker

[issue21955] ceval.c: implement fast path for integers with a single digit

2016-04-22 Thread Stefan Krah
Stefan Krah added the comment: #14757 has an implementation of inline caching, which at least seemed to slow down some use cases. Then again, whenever someone posts a new speedup suggestion, it seems to slow down things I'm working on. At least Case van Horsen independently verifie

[issue20305] Android's incomplete locale.h implementation prevents cross-compilation

2016-04-25 Thread Stefan Krah
Stefan Krah added the comment: Thank you, closing this. -- resolution: -> out of date stage: -> resolved status: open -> closed versions: +Python 3.6 -Python 3.4 ___ Python tracker <http://bugs.python.or

[issue17905] Add check for locale.h

2016-04-25 Thread Stefan Krah
Stefan Krah added the comment: Okay, closing as a duplicate (the second patch here that checks for locale.h seems too broad to me since it's a standard header). -- nosy: +skrah resolution: -> duplicate stage: -> resolved status: open -> closed superseder: -> Int

[issue17905] Add check for locale.h

2016-04-25 Thread Stefan Krah
Stefan Krah added the comment: I think all locale includes are unguarded now. -- ___ Python tracker <http://bugs.python.org/issue17905> ___ ___ Python-bugs-list m

[issue26846] Workaround for non-standard stdlib.h on Android

2016-04-25 Thread Stefan Krah
New submission from Stefan Krah: Android's stdlib.h pollutes the namespace by including a memory.h header. -- assignee: skrah components: Build messages: 264199 nosy: skrah, xdegaye priority: normal severity: normal status: open title: Workaround for non-standard stdlib.h on An

[issue26846] Workaround for non-standard stdlib.h on Android

2016-04-25 Thread Stefan Krah
Changes by Stefan Krah : -- resolution: -> fixed stage: -> resolved status: open -> closed ___ Python tracker <http://bugs.python.org/issue26846> ___

[issue22747] Interpreter fails in initialize on systems where HAVE_LANGINFO_H is undefined

2016-04-25 Thread Stefan Krah
Stefan Krah added the comment: We don't support Android officially yet, but I think until #8610 is resolved something must be done here. -- ___ Python tracker <http://bugs.python.org/is

[issue20306] Lack of pw_gecos field in Android's struct passwd causes cross-compilation for the pwd module to fail

2016-04-25 Thread Stefan Krah
Changes by Stefan Krah : -- assignee: -> skrah components: +Build -Cross-Build nosy: +skrah resolution: -> fixed stage: -> resolved status: open -> closed versions: +Python 3.6 -Python 3.4, Python 3.5 ___ Python tracker <http://

[issue26723] Add an option to skip _decimal module

2016-04-26 Thread Stefan Krah
Stefan Krah added the comment: After #26846 _decimal builds on Android. -- resolution: rejected -> fixed superseder: -> Workaround for non-standard stdlib.h on Android ___ Python tracker <http://bugs.python.org/i

[issue26846] Workaround for non-standard stdlib.h on Android

2016-04-26 Thread Stefan Krah
Stefan Krah added the comment: > Maybe issue #26723 can be closed now as well ? I think it was already closed, but I added a link to this issue now. -- ___ Python tracker <http://bugs.python.org/issu

[issue20306] Lack of pw_gecos field in Android's struct passwd causes cross-compilation for the pwd module to fail

2016-04-26 Thread Stefan Krah
Stefan Krah added the comment: Okay, for the record: I think that returning "None" would probably be more correct than the empty string, but I don't think users actually care to the point that they will introduce a case split in their applications. Realistically, probably no

[issue26839] python always calls getrandom() at start, causing long hang after boot

2016-04-26 Thread Stefan Krah
Stefan Krah added the comment: Hmm. Why does os.urandom(), which should explicitly not block, use a blocking getrandom() function? This is quite unexpected on Linux. -- nosy: +skrah ___ Python tracker <http://bugs.python.org/issue26

[issue26839] python always calls getrandom() at start, causing long hang after boot

2016-04-26 Thread Stefan Krah
Stefan Krah added the comment: Wow, it's by design: " os.urandom(n) Return a string of n random bytes suitable for cryptographic use." ``man urandom'': "A read from the /dev/urandom device will not block waiting for more entropy. As a result, if t

[issue26839] Python 3.5 running in a virtual machine with Linux kernel 3.17+ can block at startup or on importing the random module on getrandom()

2016-04-26 Thread Stefan Krah
Stefan Krah added the comment: It is clear how /dev/urandom works. I just think that securing enough entropy on startup should be done by the init scripts (if systemd still allows that :) and not by an application. [Unless the application is gpg or similar

[issue26839] Python 3.5 running in a virtual machine with Linux kernel 3.17+ can block at startup or on importing the random module on getrandom()

2016-04-26 Thread Stefan Krah
Stefan Krah added the comment: I did not claim that it magically creates entropy. -- Many VMs are throwaway test beds. It would be annoying to setup some entropy gathering mechanism just so that Python starts. -- ___ Python tracker <h

[issue26857] gethostbyname_r() is broken on android

2016-04-26 Thread Stefan Krah
Stefan Krah added the comment: Thanks, fixed. -- assignee: -> skrah nosy: +skrah resolution: -> fixed stage: -> resolved status: open -> closed ___ Python tracker <http://bugs.python

[issue26854] missing header on android for the ossaudiodev module

2016-04-26 Thread Stefan Krah
Stefan Krah added the comment: Thanks! -- assignee: -> skrah nosy: +skrah resolution: -> fixed stage: -> resolved status: open -> closed ___ Python tracker <http://bugs.python

[issue26863] android lacks some declarations for the posix module

2016-04-26 Thread Stefan Krah
Stefan Krah added the comment: Thanks again! -- assignee: -> skrah nosy: +skrah resolution: -> fixed stage: -> resolved status: open -> closed ___ Python tracker <http://bugs.python

[issue26862] SYS_getdents64 does not need to be defined on android API 21

2016-04-26 Thread Stefan Krah
Stefan Krah added the comment: @shiz: Can we settle on API level 21 or is there any reason to leave this in? -- nosy: +skrah ___ Python tracker <http://bugs.python.org/issue26

[issue26854] missing header on android for the ossaudiodev module

2016-04-26 Thread Stefan Krah
Stefan Krah added the comment: Since Android is the only known system with an odd include path, I prefer the short patch. In general, let's try to keep patches as short as possible (which Xavier is already doing). -- ___ Python tracker

[issue26853] missing symbols in curses and readline modules on android

2016-04-26 Thread Stefan Krah
Stefan Krah added the comment: Do you need libtinfow? It seems that it's not supported in setup.py, and getting even libtinfo support into some Linux distributions took quite a while. -- nosy: +skrah ___ Python tracker <http://bugs.py

[issue26853] missing symbols in curses and readline modules on android

2016-04-26 Thread Stefan Krah
Stefan Krah added the comment: IOW, on Linux tinfo should work fine in combination with ncursesw. -- ___ Python tracker <http://bugs.python.org/issue26

[issue16255] subrocess.Popen needs /bin/sh but Android only has /system/bin/sh

2016-04-26 Thread Stefan Krah
Stefan Krah added the comment: It seems that Android is the only known platform that deviates from /bin/sh. So perhaps we should simply set a variable to either /bin/sh or /system/bin/sh rather than waiting for #16353 to settle. -- nosy: +skrah versions: +Python 3.6 -Python 3.4

[issue26871] Change weird behavior of PyModule_AddObject()

2016-04-27 Thread Stefan Krah
Stefan Krah added the comment: I think the current behavior is good for error handling by goto, which is common for module initialization. Please don't change this. -- nosy: +skrah ___ Python tracker <http://bugs.python.org/is

[issue26871] Change weird behavior of PyModule_AddObject()

2016-04-27 Thread Stefan Krah
Stefan Krah added the comment: Your definition of correctness is very odd. The "leaks" you are talking about are single references in case of a module initialization failure, in which case you are likely to have much bigger problems. Please take _decimal out of this patch, it's

[issue26871] Change weird behavior of PyModule_AddObject()

2016-04-27 Thread Stefan Krah
Changes by Stefan Krah : -- nosy: -skrah ___ Python tracker <http://bugs.python.org/issue26871> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue26871] Change weird behavior of PyModule_AddObject()

2016-04-27 Thread Stefan Krah
Stefan Krah added the comment: It seems that the patch also introduces a segfault if PyLong_FromSsize_t() returns NULL. -- nosy: +skrah ___ Python tracker <http://bugs.python.org/issue26

[issue26883] input() call blocks multiprocessing

2016-04-29 Thread Stefan Forstenlechner
New submission from Stefan Forstenlechner: If input is called right away after applying a single job to multiprocessing.Pool or submitting concurrent.futures.ProcessPoolExecutor then the processes are not started. If multiple jobs are submitted everything works fine. This only seems to be a

[issue26871] Change weird behavior of PyModule_AddObject()

2016-04-29 Thread Stefan Krah
Stefan Krah added the comment: Serhiy, I'm sorry that I overreacted here. You're doing great work for Python -- we just happen to disagree on this one particular issue. I think there were some proponents on python-dev, perhaps they'll show up and disc

[issue26975] Decimal.from_float works incorrectly for non-binary floats

2016-05-08 Thread Stefan Krah
Stefan Krah added the comment: It seems to work correctly here for non-binary floats: >>> from _pydecimal import Decimal >>> Decimal.from_float(Decimal("1.2")) Traceback (most recent call last): File "", line 1, in File "/usr/local/lib/python

[issue26975] Decimal.from_float works incorrectly for non-binary floats

2016-05-08 Thread Stefan Krah
Stefan Krah added the comment: As Mark hinted at, many people would say there is no issue at all. Subclassing like that often breaks the Liskov Substitution Principle. For more information, see e.g.: http://okmij.org/ftp/Computation/Subtyping/ "Alas, LSP when considered from an OOP

[issue26857] gethostbyname_r() is broken on android

2016-05-11 Thread Stefan Krah
Stefan Krah added the comment: How about supporting API >= 23 only? Can people upgrade their devices or do they have to buy a new one? -- nosy: +Chi Hsuan Yen ___ Python tracker <http://bugs.python.org/issu

[issue26839] Python 3.5 running on Linux kernel 3.17+ can block at startup or on importing the random module on getrandom()

2016-05-13 Thread Stefan Krah
Changes by Stefan Krah : -- nosy: -skrah ___ Python tracker <http://bugs.python.org/issue26839> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue1222585] C++ compilation support for distutils

2016-05-17 Thread Stefan Krah
Changes by Stefan Krah : -- nosy: +skrah versions: +Python 3.5, Python 3.6 -Python 3.4 ___ Python tracker <http://bugs.python.org/issue1222585> ___ ___ Python-bug

[issue26331] Tokenizer: allow underscores for grouping in numeric literals

2016-05-18 Thread Stefan Krah
Stefan Krah added the comment: Thanks, Georg! The decimal parts look good to me. I understand that people wonder about the relaxed rules for Decimal -- we have discussed that here: https://mail.python.org/pipermail/python-dev/2016-March/143557.html I don't think that it will be a pr

[issue27054] Python installation problem: No module named 'encodings'

2016-05-19 Thread Stefan Krah
Stefan Krah added the comment: I can only comment on the Windows 10 issue: I think I did the install with "Right-click -> Run as administrator" and then installed for all users. Encodings, pip and everything else works here. --

[issue26857] gethostbyname_r() is broken on android

2016-05-22 Thread Stefan Krah
Stefan Krah added the comment: Okay thanks, let's assume api-level >= 21 for now. I've moved the include into pyport.h in order to save a little space everywhere. Could you check if that works? -- Added file: http://bugs.python.org/file42944/is

[issue26857] gethostbyname_r() is broken on android

2016-05-22 Thread Stefan Krah
Stefan Krah added the comment: Thanks! Closing again. -- resolution: -> fixed status: open -> closed ___ Python tracker <http://bugs.python.org/i

[issue16255] subrocess.Popen needs /bin/sh but Android only has /system/bin/sh

2016-05-22 Thread Stefan Krah
Stefan Krah added the comment: I've also opened a feature request here: https://code.google.com/p/android/issues/detail?id=210812 -- ___ Python tracker <http://bugs.python.org/is

[issue23507] Tuple creation is too slow

2015-02-24 Thread Stefan Behnel
Changes by Stefan Behnel : -- nosy: +scoder ___ Python tracker <http://bugs.python.org/issue23507> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue23496] Steps for Android Native Build of Python 3.4.2

2015-02-27 Thread Stefan Krah
Stefan Krah added the comment: > c) constantly working at making the latest and greatest Android-friendly But that is precisely what "Android support", should it be added, means: It does take constant work (and build slaves) to support a platform. Unrelatedly, regarding the local

[issue23496] Steps for Android Native Build of Python 3.4.2

2015-02-27 Thread Stefan Krah
Stefan Krah added the comment: But NDK bugs are reported to the same bug tracker, aren't they? -- ___ Python tracker <http://bugs.python.org/issue23496> ___ ___

[issue23496] Steps for Android Native Build of Python 3.4.2

2015-02-27 Thread Stefan Krah
Stefan Krah added the comment: BTW, PEP 11 now demands a stable buildbot for official platform support (IMO a very sane policy). -- ___ Python tracker <http://bugs.python.org/issue23

[issue23496] Steps for Android Native Build of Python 3.4.2

2015-02-28 Thread Stefan Krah
Stefan Krah added the comment: > I wouldn't know if they're reported to the same bug tracker...it's possible > they aren't. Well, why don't you try? :) > Additionally it's possible that the lack of locale support in libc isn't > considered a

[issue23496] Steps for Android Native Build of Python 3.4.2

2015-02-28 Thread Stefan Krah
Stefan Krah added the comment: Fine, I'm also optimizing and the "fix" isn't going into libmpdec. Android can use the Python version of decimal. -- ___ Python tracker <http://bug

[issue23545] Turn on extra warnings on GCC

2015-02-28 Thread Stefan Krah
Stefan Krah added the comment: +1. I think the flags should go into CFLAGS_NODIST. -- nosy: +skrah ___ Python tracker <http://bugs.python.org/issue23545> ___ ___

[issue20305] Android's incomplete locale.h implementation prevents cross-compilation

2015-02-28 Thread Stefan Krah
Stefan Krah added the comment: Consider the libmpdec part rejected. It is too much work given that external libmpdecs need to be compatible and Android can use the Python version of decimal. -- nosy: +skrah ___ Python tracker <h

[issue20408] memoryview() constructor documentation error

2015-03-01 Thread Stefan Krah
Stefan Krah added the comment: I agree that "obj" would be nicer. On the other hand we explicitly test for "object" in the tests, help(memoryview) says "object" and pypy accepts "object". Also, I think there may be other instances in the tree wher

[issue23496] Steps for Android Native Build of Python 3.4.2

2015-03-09 Thread Stefan Krah
Stefan Krah added the comment: > ImportError: cannot import name 'module_from_spec' The command line uses the system python3, which is "too old" and does not have 'module_from_spec' yet. Try running ... python3 -S -m sysconfig --generate-posix-vars ... an

[issue23496] Steps for Android Native Build of Python 3.4.2

2015-03-09 Thread Stefan Krah
Stefan Krah added the comment: Cross compiling worked for a while in 3.4. It broke again because we don't have a buildbot for that. You should not need 20 args for ./configure. At least on Ubuntu the script from #5404 generally works, but indeed pgen, importlib and the above issue are curr

[issue23496] Steps for Android Native Build of Python 3.4.2

2015-03-09 Thread Stefan Krah
Stefan Krah added the comment: On Ubuntu, when I uploaded the script to #5404, I only needed: ./configure --prefix=/tmp/arm-install --without-ensurepip --host=arm-linux-gnueabi --build=x86_64 --disable-ipv6 (And config.site of course.) We just have to fix the pgen etc. issues and someone

[issue23496] Steps for Android Native Build of Python 3.4.2

2015-03-09 Thread Stefan Krah
Stefan Krah added the comment: Technically we could use the Android buildbot to test both (cross-compiling and Android breakage), but it would be nice to have a separate buildbot that just tests cross-compiling with an easier target (e.g. arm-linux-gnueabi

[issue23496] Steps for Android Native Build of Python 3.4.2

2015-03-10 Thread Stefan Krah
Changes by Stefan Krah : -- nosy: -skrah ___ Python tracker <http://bugs.python.org/issue23496> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue23632] memoryview doesn't allow tuple-indexing

2015-03-12 Thread Stefan Krah
Stefan Krah added the comment: Multi-dimensional slicing is explicitly mentioned in PEP-3118, so I guess the intention was to cover this use case as well. -- ___ Python tracker <http://bugs.python.org/issue23

[issue23632] memoryview doesn't allow tuple-indexing

2015-03-12 Thread Stefan Krah
Stefan Krah added the comment: To be sure, the PEP contains some odd proposals like "Unpacking a long-double will return a decimal object", but the one in this issue seems reasonable. -- ___ Python tracker <http://bugs.python.o

[issue23632] memoryview doesn't allow tuple-indexing

2015-03-12 Thread Stefan Krah
Stefan Krah added the comment: sub-views and multi-dimensional slicing are not that bad: They're already implemented in _testbuffer (indeed with intermediate objects though). -- ___ Python tracker <http://bugs.python.org/is

[issue23632] memoryview doesn't allow tuple-indexing

2015-03-12 Thread Stefan Krah
Stefan Krah added the comment: Yes, to be clear I'm +1 on this specific feature -- and separate issues. :) -- ___ Python tracker <http://bugs.python.org/is

[issue23632] memoryview doesn't allow tuple-indexing

2015-03-14 Thread Stefan Krah
Stefan Krah added the comment: It turns out that msg237933 was too simplistic: There are some intricacies of numpy array indexing that *are* very complex: http://docs.scipy.org/doc/numpy/reference/arrays.indexing.html In particular, x[::2, 1, ::2] is not necessarily equal to x[::2][1][::2

[issue23699] Add a macro to ease writing rich comparisons

2015-03-18 Thread Stefan Krah
Changes by Stefan Krah : -- nosy: +skrah ___ Python tracker <http://bugs.python.org/issue23699> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue23699] Add a macro to ease writing rich comparisons

2015-03-18 Thread Stefan Krah
Stefan Krah added the comment: Hmm, at least for the version at https://mail.python.org/pipermail/python-ideas/2015-March/032564.html I'm not sure if the optimizer will produce the same code as for the switch statement. Did you look at th

[issue23712] Experiment: Assume that exact unicode hashes are perfect discriminators

2015-03-20 Thread Stefan Behnel
Stefan Behnel added the comment: The problem is, even if the chance is excessively small, it's not zero. Meaning, someone's data set somewhere will break somehow. And with hash randomisation, it'll mean that the problem spotted in some life system will be entirely unrepro

[issue23642] Interaction of ModuleSpec and C Extension Modules

2015-03-22 Thread Stefan Behnel
Changes by Stefan Behnel : -- nosy: +scoder ___ Python tracker <http://bugs.python.org/issue23642> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue23688] unnecessary copying of memoryview in gzip.GzipFile.write?

2015-03-23 Thread Stefan Krah
Stefan Krah added the comment: I think there's a behavior change: Before you could gzip non-contiguous views directly, now that operation raises BufferError. -- nosy: +skrah ___ Python tracker <http://bugs.python.org/is

[issue23688] unnecessary copying of memoryview in gzip.GzipFile.write?

2015-03-23 Thread Stefan Krah
Stefan Krah added the comment: Sure: import gzip x = memoryview(b'x' * 10) y = x[::-1] with gzip.GzipFile("x", 'w') as f: f.write(y) -- ___ Python tracker <

[issue23688] unnecessary copying of memoryview in gzip.GzipFile.write?

2015-03-23 Thread Stefan Krah
Stefan Krah added the comment: > In a sense, the old behavior was an artefact of silently copying the > memoryview to bytes. It likely wasn't intentional, but tobytes() *is* used to serialize weird arrays to their C-contiguous representation (following the logical structure of the a

[issue23688] unnecessary copying of memoryview in gzip.GzipFile.write?

2015-03-23 Thread Stefan Krah
Stefan Krah added the comment: I just see that non-contiguous arrays didn't work in 2.7 either, so that was probably the original intention. -- ___ Python tracker <http://bugs.python.org/is

[issue23602] Implement __format__ for Fraction

2015-03-23 Thread Stefan Behnel
Stefan Behnel added the comment: Absolutely. Fractions are all about exact calculations, much more so than Decimals. So the formatting output should be as accurate as requested or possible (well, excluding infinity). -- nosy: +scoder ___ Python

[issue23602] Implement __format__ for Fraction

2015-03-26 Thread Stefan Krah
Stefan Krah added the comment: Decimal formatting intentionally differs from float formatting, see #23460. -- ___ Python tracker <http://bugs.python.org/issue23

[issue23602] Implement __format__ for Fraction

2015-03-26 Thread Stefan Krah
Stefan Krah added the comment: The zero isn't missing. :) We are following http://speleotrove.com/decimal/decarith.html, with thousands of test cases. We could decide to do something special for "g", but there are good reasons

[issue23602] Implement __format__ for Fraction

2015-03-29 Thread Stefan Behnel
Stefan Behnel added the comment: But these parameters could also be partly delegated to normal string (not number) formatting, right? One of the advantages of not depending on Decimal is, well, to not depend on Decimal, which is a rather uncommon dependency when using Fractions in an

[issue23602] Implement __format__ for Fraction

2015-03-29 Thread Stefan Behnel
Stefan Behnel added the comment: Meaning, something like this should work: x = (nom * 10**(prec+1)) // den if x % 10 < 5: x = x // 10 else: x = x // 10 + 1 print('%s.%s' % (x[:-prec], x[-prec:])) -- ___ P

[issue23602] Implement __format__ for Fraction

2015-03-29 Thread Stefan Behnel
Stefan Behnel added the comment: Or, speaking of "division with remainder": n, r = divmod(nom * 10**prec, den) if r * 5 >= den: n += 1 x = str(n) print('%s.%s' % (x[:-prec], x[-prec:])) ... minus the usual off-by-one that the t

[issue23602] Implement __format__ for Fraction

2015-03-30 Thread Stefan Krah
Stefan Krah added the comment: Regarding Decimal: 1) The context precision isn't used for formatting. If you have another reason for proposing the optional context argument for dec_format(), please open another issue. 2) There's another problem: The mythical Defa

[issue23607] Inconsistency in datetime.utcfromtimestamp(Decimal)

2015-03-30 Thread Stefan Krah
Stefan Krah added the comment: I just looked at this very briefly: Is the patch context insensitive? IOW, do things still work if you change the thread-local context: from decimal import * c = getcontext() c.prec = 1 c.Emax = 1 c.Emin = -1 -- nosy: +skrah

[issue23607] Inconsistency in datetime.utcfromtimestamp(Decimal)

2015-03-30 Thread Stefan Krah
Stefan Krah added the comment: I think we should try to avoid depending on global state in the stdlib, at least in new code. Also, if something is not really a decimal computation, Decimal itself tries to ignore the context (like Decimal.__repr__). At least I would expect this datetime

[issue23602] Implement __format__ for Fraction

2015-03-31 Thread Stefan Krah
Stefan Krah added the comment: > It wouldn't be too bad if Py and C version of Decimal.__format__ had > same interface. What do you think? Let's discuss that in a separate issue. [DefaultContext] > I don't understand what do you mean with this. Is this something that

[issue16991] Add OrderedDict written in C

2015-03-31 Thread Stefan Behnel
Stefan Behnel added the comment: > do not add a C-API what speaks against it? -- nosy: +scoder ___ Python tracker <http://bugs.python.org/issue16991> ___ _

[issue23756] Tighten definition of bytes-like objects

2015-04-01 Thread Stefan Krah
Stefan Krah added the comment: I have a somewhat general concern: In the last year or so, issues seem to expand far beyond the scope that's indicated by the issue title. For example, I don't particularly care about the definition of "bytes-like", but the patch contains ch

[issue23847] Add xml pretty print option to ElementTree

2015-04-02 Thread Stefan Behnel
Stefan Behnel added the comment: duplicate of issue 14465 -- nosy: +rhettinger ___ Python tracker <http://bugs.python.org/issue23847> ___ ___ Python-bugs-list m

[issue23756] Tighten definition of bytes-like objects

2015-04-02 Thread Stefan Krah
Changes by Stefan Krah : -- assignee: docs@python -> skrah ___ Python tracker <http://bugs.python.org/issue23756> ___ ___ Python-bugs-list mailing list Un

[issue23376] getargs.c: redundant C-contiguity check

2015-04-02 Thread Stefan Krah
Changes by Stefan Krah : -- assignee: -> skrah ___ Python tracker <http://bugs.python.org/issue23376> ___ ___ Python-bugs-list mailing list Unsubscrib

[issue23756] Tighten definition of bytes-like objects

2015-04-02 Thread Stefan Krah
Stefan Krah added the comment: If you think that the previous version was "incorrect and misleading", the bar for changes to be accepted seems pretty high for me. "grep -r" doesn't seem to find "flattened length" in Doc/*. "An object that supports the

<    43   44   45   46   47   48   49   50   >