[issue41402] email: ContentManager.set_content calls nonexistent method encode() on bytes
Johannes Reiff added the comment: Could someone comment on the way forward? Or ideally just merge my PR (it was approved on GitHub)? I am still very much interested in this bug getting fixed. -- ___ Python tracker <https://bugs.python.org/issue41402> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43116] Integer division numerical error
New submission from Johannes : I'm a bit confused because this seems to be too obvious to be a bug: [code] >>> -2094820900 // 1298 -1613884 >>> -2094820900 // -1298 1613883 [/code] Obviously there is a +/- 1 difference in the result. Tested with Python 3.7, 3.8 and 3.9 on Debian Bullseye. Am I missing something? -- messages: 386204 nosy: jfu33.4 priority: normal severity: normal status: open title: Integer division numerical error type: behavior versions: Python 3.7, Python 3.8, Python 3.9 ___ Python tracker <https://bugs.python.org/issue43116> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue41402] email: ContentManager.set_content calls nonexistent method encode() on bytes
Johannes Reiff added the comment: It has been almost a month since the last update, so pinging as suggested in the Developer's Guide. Do I need to do something before the PR can be merged? -- ___ Python tracker <https://bugs.python.org/issue41402> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue41402] email: ContentManager.set_content calls nonexistent method encode() on bytes
Johannes Reiff added the comment: Thanks! Is there anything I need to do regarding the Python 3.8 and 3.9 backports? -- ___ Python tracker <https://bugs.python.org/issue41402> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue41402] email: ContentManager.set_content calls nonexistent method encode() on bytes
New submission from Johannes Reiff : If assigning binary content to an EmailMessage via set_content(), the function email.contentmanager.set_bytes_content() is called. This function fails when choosing the 7bit transfer encoding because of a call to data.decode('ascii'). -- components: email messages: 374337 nosy: Johannes Reiff, barry, r.david.murray priority: normal severity: normal status: open title: email: ContentManager.set_content calls nonexistent method encode() on bytes versions: Python 3.10, Python 3.8, Python 3.9 ___ Python tracker <https://bugs.python.org/issue41402> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40899] Ddcument exceptions raised by importlib.import
New submission from Johannes Buchner : https://docs.python.org/3/library/functions.html#__import__ and https://docs.python.org/3/library/importlib.html#importlib.import_module do not list which Exceptions are raised in case the module cannot be imported. The two exceptions are listed here https://docs.python.org/3/library/exceptions.html#ImportError ModuleNotFoundError Could you add a half-sentence "and raises an ModuleNotFoundError if import was unsuccessful." to the function docs? -- assignee: docs@python components: Documentation messages: 370887 nosy: docs@python, j13r priority: normal severity: normal status: open title: Ddcument exceptions raised by importlib.import versions: Python 3.10, Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 3.9 ___ Python tracker <https://bugs.python.org/issue40899> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35883] Change invalid unicode characters to replacement characters in argv
Johannes Berg added the comment: I've also filed https://sourceware.org/bugzilla/show_bug.cgi?id=26034 for glibc, because that's where really the issues seems to be? But perhaps python should be forgiving of glibc errors here. -- ___ Python tracker <https://bugs.python.org/issue35883> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35883] Change invalid unicode characters to replacement characters in argv
Johannes Berg added the comment: Like I said above, it could be argued that the bug is in glibc, and then https://p.sipsolutions.net/6a4e9fce82dbbfa0.txt could be used as a simple LD_PRELOAD wrapper to work around this, just to illustrate the problem from that side. Arguably, that makes glibc in violation of RFC 3629, since it says: 3. UTF-8 definition [...] In UTF-8, characters from the U+..U+10 range (the UTF-16 accessible range) are encoded using sequences of 1 to 4 octets. [...] (hexadecimal)| (binary) +- - 007F | 0xxx 0080- 07FF | 110x 10xx 0800- | 1110 10xx 10xx 0001 -0010 | 0xxx 10xx 10xx 10xx [...] Implementations of the decoding algorithm above MUST protect against decoding invalid sequences. [...] Here's a simple test program: https://p.sipsolutions.net/ac091b4ea4b7f742.txt -- ___ Python tracker <https://bugs.python.org/issue35883> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35883] Change invalid unicode characters to replacement characters in argv
Johannes Berg added the comment: And wrt. _Py_DecodeUTF8Ex() - it doesn't seem to help. But that's probably because I'm not __ANDROID__, nor __APPLE__, and then regardless of current_locale being non-zero or not, we end up in decode_current_locale() where the impedance mismatch happens. Setting PYTHONUTF8=1 in the environment works too, in that case we do get into _Py_DecodeUTF8Ex(). -- ___ Python tracker <https://bugs.python.org/issue35883> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35883] Change invalid unicode characters to replacement characters in argv
Johannes Berg added the comment: In fact that python one-liner works with just about everything else that you can throw at it, just not something that "looks like utf-8 but isn't". And of course adding LC_CTYPE=ascii or something like that fixes it, as you'd expect. Then the "surrogateescape" works fine, since mbstowcs() won't try to decode it as utf-8. -- ___ Python tracker <https://bugs.python.org/issue35883> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35883] Change invalid unicode characters to replacement characters in argv
Johannes Berg added the comment: A simple test case is something like ./python -c 'import sys; print(sys.argv[1].encode(sys.getfilesystemencoding(), "surrogateescape"))' "$(echo -ne '\xfa\xbd\x83\x96\x80')" Which you'd probably expect to print b'\xfa\xbd\x83\x96\x80' i.e. the same bytes that were passed in, but currently that fails. -- versions: +Python 3.10, Python 3.5, Python 3.8, Python 3.9 ___ Python tracker <https://bugs.python.org/issue35883> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35883] Change invalid unicode characters to replacement characters in argv
Johannes Berg added the comment: Pretty sure this is an issue still, I see it on current git master. This seems to work around it? https://p.sipsolutions.net/603927f1537226b3.txt Basically, it seems that mbstowcs() and mbrtowc() on glibc with utf-8 just blindly decode even invalid UTF-8 to a too large wchar_t, rather than failing. -- nosy: +jberg ___ Python tracker <https://bugs.python.org/issue35883> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue34271] Please support logging of SSL master secret by env variable SSLKEYLOGFILE
Johannes Frank added the comment: Yes, I didn't revisit the issue since, but Malcolm is right. Implemented in python 3.8. Thanks to all the contributors. On Sat, Feb 29, 2020 at 8:58 AM Malcolm Smith wrote: > > Malcolm Smith added the comment: > > It looks like this has now been done and released. Can the issue be closed? > > -- > nosy: +Malcolm Smith > > ___ > Python tracker > <https://bugs.python.org/issue34271> > ___ > -- ___ Python tracker <https://bugs.python.org/issue34271> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38784] ip_network does not clear/update the broadcast_address cache when network_address is changed.
Johannes Erwerle added the comment: since it hasn't been documented that those classes are all designed to be immutable (and many things work when they are mutable) many people probably use it that way. Declaring them immutable via the docs now would "break" existing code. -- ___ Python tracker <https://bugs.python.org/issue38784> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38784] ip_network does not clear/update the broadcast_address cache when network_address is changed.
Change by Johannes Erwerle : -- title: ip_network does not clear/update the broadcast_address cache when the IP address is changed. -> ip_network does not clear/update the broadcast_address cache when network_address is changed. ___ Python tracker <https://bugs.python.org/issue38784> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38784] ip_network does not clear/update the broadcast_address cache when the IP address is changed.
New submission from Johannes Erwerle : The ip_network class in the ipaddress module does cache the broadcast_address attribute. But when the network address is changed the cache is not cleared/updated. Example: > from ipaddress import ip_network > > print("--") > > net = ip_network("10.0.0.0/8") > print("net", net) > print("broadcast_address", net.broadcast_address) > print("increase") > net.network_address += 2**24 > print("net", net) > print("net.broadcast_address", net.broadcast_address) > > print("--") > > net2 = ip_network("10.0.0.0/8") > print("net2", net2) > print("no call to broadcast_address") > print("increase") > net2.network_address += 2**24 > print("net2", net2) > print("net2.broadcast_address", net2.broadcast_address) -- messages: 356522 nosy: 992jo priority: normal severity: normal status: open title: ip_network does not clear/update the broadcast_address cache when the IP address is changed. type: behavior versions: Python 3.7 ___ Python tracker <https://bugs.python.org/issue38784> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38784] ip_network does not clear/update the broadcast_address cache when the IP address is changed.
Change by Johannes Erwerle : -- versions: +Python 3.8 ___ Python tracker <https://bugs.python.org/issue38784> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17305] IDNA2008 encoding is missing
Change by Johannes Frank : -- nosy: +matrixise ___ Python tracker <https://bugs.python.org/issue17305> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue34271] Please support logging of SSL master secret by env variable SSLKEYLOGFILE
Johannes Frank added the comment: Hello Christian, much appreciated. Thank you so much. Johannes -- ___ Python tracker <https://bugs.python.org/issue34271> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue34271] Please support logging of SSL master secret by env variable SSLKEYLOGFILE
Johannes Frank added the comment: Hi Christian I would be willing to give this a try, could you publish or send me that more elaborate code? Thanks Johannes On Wed, 26 Sep 2018 at 09:25, Christian Heimes wrote: > > Christian Heimes added the comment: > > Here is a horribly hacky and simple implementation. I have a more > elaborate implementation that does correct locking and has no global state. > > static BIO *bio_keylog = NULL; > > static void keylog_callback(const SSL *ssl, const char *line) > { > BIO_printf(bio_keylog, "%s\n", line); > (void)BIO_flush(bio_keylog); > } > > int PySSL_set_keylog_file(SSL_CTX *ctx, const char *keylog_file) > { > /* Close any open files */ > BIO_free_all(bio_keylog); > bio_keylog = NULL; > > if (ctx == NULL || keylog_file == NULL) { > /* Keylogging is disabled, OK. */ > return 0; > } > > /* > * Append rather than write in order to allow concurrent modification. > * Furthermore, this preserves existing keylog files which is useful > when > * the tool is run multiple times. > */ > bio_keylog = BIO_new_file(keylog_file, "a"); > if (bio_keylog == NULL) { > BIO *b = BIO_new_fp(stderr, BIO_NOCLOSE | BIO_FP_TEXT); > BIO_printf(b, "Error writing keylog file %s\n", keylog_file); > BIO_free_all(b); > return 1; > } > > /* Write a header for seekable, empty files (this excludes pipes). */ > if (BIO_tell(bio_keylog) == 0) { > BIO_puts(bio_keylog, > "# SSL/TLS secrets log file, generated by OpenSSL\n"); > (void)BIO_flush(bio_keylog); > } > SSL_CTX_set_keylog_callback(ctx, keylog_callback); > return 0; > } > > -- > stage: -> needs patch > versions: +Python 3.8 -Python 3.7 > > ___ > Python tracker > <https://bugs.python.org/issue34271> > ___ > -- ___ Python tracker <https://bugs.python.org/issue34271> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue34665] Py_FinalizeEx() - Bugs & caveats - Add info that NumPy and Pandas don't support reinitialization
New submission from Johannes M. : Since about a decade, it's a know problem that NumPy and Pandas initialization function crashes on reinitialization after a call to Py_Finalize() + Py_Initialize(). [https://github.com/numpy/numpy/issues/8097] [https://github.com/numpy/numpy/issues/11925] It seems to be unlikely that this problem gets fixed soon. Due to the popularity of the modules, it would be good to add this information to the documentation of Py_FinalizeEx(), such that developers, who are planning to embed Python get this information already at the moment when they read the documentation. I would suggest to change the following sentence: Some extensions may not work properly if their initialization routine is called more than once; to Some extensions, like NumPy and Pandas, may not work properly if their initialization routine is called more than once; -- assignee: docs@python components: Documentation messages: 325275 nosy: docs@python, jcmuel priority: normal severity: normal status: open title: Py_FinalizeEx() - Bugs & caveats - Add info that NumPy and Pandas don't support reinitialization type: enhancement versions: Python 3.7, Python 3.8 ___ Python tracker <https://bugs.python.org/issue34665> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue34271] Please support logging of SSL master secret by env variable SSLKEYLOGFILE
Change by Johannes Frank : -- title: Please support logging of SSL master secret by env variable SSLKEYLOGFILe -> Please support logging of SSL master secret by env variable SSLKEYLOGFILE ___ Python tracker <https://bugs.python.org/issue34271> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue34271] Please support logging of SSL master secret by env variable SSLKEYLOGFILe
New submission from Johannes Frank : As discussed on the EuroPython 2018 it would be a great improvement if the python SSL module would respect the SSLKEYLOGFILE environment variable to log the master secret and the client random for packet trace decryption. The pycurl module compiled against libopenssl 1.1.0h does already work. OpenSSL 1.1.1 will offer to register a callback that will log the keys. There is also c code available using LD_PRELOAD here: https://git.lekensteyn.nl/peter/wireshark-notes/tree/src/sslkeylog.c It would be great if a call to the requests, aiohttp, urllib3 or asks library would lead to the keys logged if the environment variable is set from within python. Thank you -- assignee: christian.heimes components: SSL files: pycurl-get.py messages: 322632 nosy: christian.heimes, jmfrank63 priority: normal severity: normal status: open title: Please support logging of SSL master secret by env variable SSLKEYLOGFILe type: enhancement versions: Python 3.7 Added file: https://bugs.python.org/file47719/pycurl-get.py ___ Python tracker <https://bugs.python.org/issue34271> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue33848] Incomplete format string syntax for Exceptions
New submission from Johannes Raggam : The following is valid Python 2: >>> 'okay {0:s}'.format(Exception('test')) 'okay test' >>> 'okay {0}'.format(Exception('test')) 'okay test' The following fails on Python 3.6: >>> 'okay {0:s}'.format(Exception('test')) Traceback (most recent call last): File "", line 1, in TypeError: unsupported format string passed to Exception.__format__ While this doesn't fail: >>> 'okay {0}'.format(Exception('test')) 'okay test' -- components: ctypes messages: 319402 nosy: thet priority: normal severity: normal status: open title: Incomplete format string syntax for Exceptions versions: Python 3.6 ___ Python tracker <https://bugs.python.org/issue33848> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue33846] Misleading error message in urllib.parse.unquote
New submission from Johannes Raggam : urllib.parse.unquote gives an misleading error message when: >>> import urllib >>> urllib.parse.unquote(b'bytesurl') *** TypeError: a bytes-like object is required, not 'str' while: >>> urllib.parse.unquote('texturl') texturl The correct behavior is to pass a string/text object to unquote. But passing a bytes object gives a misleading error message. A fix would be to add an assertion in https://github.com/python/cpython/blob/0250de48199552cdaed5a4fe44b3f9cdb5325363/Lib/urllib/parse.py#L614 like: >>> assert isinstance(string, str) -- components: Library (Lib) messages: 319396 nosy: thet priority: normal severity: normal status: open title: Misleading error message in urllib.parse.unquote type: enhancement versions: Python 3.6 ___ Python tracker <https://bugs.python.org/issue33846> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6766] Cannot modify dictionaries inside dictionaries using Managers from multiprocessing
Johannes added the comment: Hi all, I'm trying to use multiprocessing with a 3d list. From the documentation I expected it to work. As I found this report a bid later, I opened a bug report here: https://bugs.python.org/issue32538. Am I doing sth. wrong or is it still not working in 3.6.3? -- nosy: +John_81 ___ Python tracker <https://bugs.python.org/issue6766> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue32538] Multiprocessing Manager on 3D list - no change of the list possible
New submission from Johannes : I have the following code, which works without multiprocessing: data=[[['','','','','','','','','','','','']]] data[0][0][0] = 5 data[0][0][1] = "5" # data in the array is mixed with float and str print(data) #=> [[[5, '5', '', '', '', '', '', '', '', '', '', '']]] Now I want to use Multiprocessing and every process should be able to change the 3D list. This doesn't work and no error message is shown. from multiprocessing import Process, Manager manager=Manager() data=manager.list([[['','','','','','','','','','','','']]]) data[0][0][0] = 5 data[0][0][1] = "5" print(data) #=> [[['', '', '', '', '', '', '', '', '', '', '', '']]] I found the following text: list(sequence) Create a shared list object and return a proxy for it. Changed in version 3.6: Shared objects are capable of being nested. For example, a shared container object such as a shared list can contain other shared objects which will all be managed and synchronized by the SyncManager.(https://docs.python.org/3/library/multiprocessing.html) Unfortunately it also doesn't work with 3.6.3, same problem as before! But as it should work, I guess it's a bug? I use Ubuntu 16.04... -- components: Interpreter Core messages: 309858 nosy: John_81 priority: normal severity: normal status: open title: Multiprocessing Manager on 3D list - no change of the list possible type: behavior versions: Python 3.6 ___ Python tracker <https://bugs.python.org/issue32538> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23702] docs.python.org/3/howto/descriptor.html still refers to "unbound methods"
Johannes Lade added the comment: And sorry for my lousy manners. Of course I appreciate all the hard work you do! It's just frustrating when you get confused by doc. -- ___ Python tracker <http://bugs.python.org/issue23702> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23702] docs.python.org/3/howto/descriptor.html still refers to "unbound methods"
Johannes Lade added the comment: This is still a problem. Can please somebody fix this? There are already enough confusing discussion full of wrong information about this topic, so it would be nice if the official documentation would get it right. Also there's multiple Issues for this. Can they be combined into one? Just one example I found: on https://docs.python.org/3.5/howto/descriptor.html#functions-and-methods Documentation: >>> class D(object): ... def f(self, x): ... return x ... >>> d = D() >>> D.__dict__['f'] # Stored internally as a function >>> D.f # Get from a class becomes an unbound method >>> d.f # Get from an instance becomes a bound method > ipython3.5.3 In [1]: class D(object): ...: ... def f(self, x): ...: ... return x ...: ... In [2]: d = D() In [3]: D.__dict__['f'] # Stored internally as a function Out[3]: In [4]: D.f # Get from a class becomes an unbound method Out[4]: In [5]: d.f # Get from an instance becomes a bound method Out[5]: > -- nosy: +Johannes Lade ___ Python tracker <http://bugs.python.org/issue23702> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue27321] Email parser creates a message object that can't be flattened
Johannes Löthberg added the comment: Ping? -- ___ Python tracker <http://bugs.python.org/issue27321> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue27321] Email parser creates a message object that can't be flattened
Changes by Johannes Löthberg : -- pull_requests: +2043 ___ Python tracker <http://bugs.python.org/issue27321> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue27321] Email parser creates a message object that can't be flattened
Johannes Löthberg added the comment: Ah, didn't even see your comment before I did it! Fix to the comments are on the same branch, will be rebased before PR is up. -- ___ Python tracker <http://bugs.python.org/issue27321> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue27321] Email parser creates a message object that can't be flattened
Johannes Löthberg added the comment: Fix: https://github.com/kyrias/cpython/commit/a986a8274a522c73d87360da6930e632a3eb4ebb Testcase: https://github.com/kyrias/cpython/commit/9a510426522e1d714cd0ea238b14de0fc76862b2 Can start a PR once my CLA signature goes through I guess. -- ___ Python tracker <http://bugs.python.org/issue27321> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue27321] Email parser creates a message object that can't be flattened
Johannes Löthberg added the comment: Any updates on this? I'm having the same problem with some non-spam emails while trying to use some mail-handling tools written in Python. -- nosy: +Johannes Löthberg ___ Python tracker <http://bugs.python.org/issue27321> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20491] textwrap: Non-breaking space not honored
Johannes Bauer added the comment: Hey there, wanted to follow up on the state of this... is there a reason why this has not made it into vanilla yet? If so, I'd like to try to help out clear impediments if I can. This issue is *really*, really, really annoying me. I've posted about a year ago on python-list (http://code.activestate.com/lists/python-list/685604/) and was referred to this bug and thought I'd wait it out. But now the last change was 2 years ago and no relief in sight. So if nothing else, please take it as a gentle reassurance that this bug is really affecting real-world scenarios and annoying as hell. Especially since the semantic of a non-breaking space is pretty much exactly to *not* break on text wrapping. If there's anything I can contribute to get things going again, by all means please let me know. All hands on deck! Cheers, Johannes -- nosy: +joebauer ___ Python tracker <http://bugs.python.org/issue20491> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26971] python v3.5.1: sys.paths not respecting DESTDIRS and DESTSHARED
Johannes S. added the comment: Sorry that I haven't answered for a long time. I would like to get an email notification but I don't know whether/how I can enable it. On "my instance of Linux SuSE", the lines are locking like this: CONFIG_ARGS=' '\''--prefix=/some/dir'\''' libdir='${exec_prefix}/lib64' -- ___ Python tracker <http://bugs.python.org/issue26971> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26923] asyncio.gather drops cancellation
Johannes Ebke added the comment: Attached is a new version of the patch incorporating the review results. -- Added file: http://bugs.python.org/file43508/fix_and_test_26923_reviewed.patch ___ Python tracker <http://bugs.python.org/issue26923> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26923] asyncio.gather drops cancellation
Johannes Ebke added the comment: Right, that's neater. Attached is a patch with your version and a test. I checked that it fails with the old version of cancel() and passes with the new one. Concerning possible other bugs, I've had a look in the standard library, but could not find another instance where Future.cancel() is overwritten and has special handling. I also had a look at the try/except Exception blocks in lib/asyncio, but possible Cancellations are handled correctly there. I believe the main source of bugs in this context will probably be other asyncio-based libraries. Either by inadvertently catching CancellationErrors in a try/except Exception block and treating them like other errors, or by not protecting resources with try/finally across yield points which might throw a CancellationError. Not all libraries use cancel() internally, so the authors might not be aware that they have to write "cancellation-safe" code. -- Added file: http://bugs.python.org/file43485/fix_and_test_26923.patch ___ Python tracker <http://bugs.python.org/issue26923> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26971] python v3.5.1: sys.paths not respecting DESTDIRS and DESTSHARED
Johannes S. added the comment: Maybe my last comment was not clear enogth. I used the tarballs from 3.5 and 3.6 which are linked in my last comment. I extracted them and run the the following commands on Arch (64 Bit) and Linux SuSE 13.1 (64 Bit): mkdir build cd build ../configure --prefix=/some/dir make make install The path `/some/dir` is a placeholder. The path did not exist before running this commands. After running them on Linux SuSE, I discovered that `libpython3.5m.a`, `pkgconfig/` and `python3.5/lib-dynload` was placed in `/some/dir/lib64` instead of `/some/dir/lib`. On Arch, everything is placed in `/some/dir/lib` but I have the same behavior if I add `--libdir=/some/dir/lib64` to `configure`. With other words: `--libdir` seems to have a default value of "EPREFIX/lib64" instead of "EPREFIX/lib" on my instance of Linux SuSE. Maybe `configure` uses some global configurations here? The problem is, that `sys.path` does point to `/some/dir/lib/lib-dynload` in all cases described above. Since `python3.5/lib-dynload` may be placed in `lib64`, this may cause that python does not run properly after installing it. (Unfortunately, I cannot say much about the configuration of "my instance of Linux SuSE" since I am not the person who set it up. It is a server of my university.) -- status: pending -> open ___ Python tracker <http://bugs.python.org/issue26971> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26923] asyncio.gather drops cancellation
Johannes Ebke added the comment: On rereading my original description, it really is not clearly described why the calling Task ends up surviving. Attached is a patch to the 3.5.1 asyncio/tasks.py which adds some print statements in Task.cancel(). If I execute the cancellation_test.py with the patch applied, the output looks like this: Cancelling the task: wait_for=<_GatheringFuture pending cb=[Task._wakeup()]> cb=[Task._wakeup()]> Entered Task.cancel() for task wait_for=<_GatheringFuture pending cb=[Task._wakeup()]> cb=[Task._wakeup()]> Task is not done() and we have a _fut_waiter: Cancelling fut_waiter <_GatheringFuture pending cb=[Task._wakeup()]> Entered Task.cancel() for task result=None> Task is done(), refusing to cancel Great, _fut_waiter has agreed to be cancelled. We can now also return True Cancellation returned: True All children finished OK, setting _GatheringFuture results! Finished gathering. Proof that this is running even though it was cancelled The Task keeps on running because Task.cancel() trusts its _fut_waiter task to handle the cancellation correctly if its cancel() method returns True. If it returns False, it handles the Cancellation itself. In this case, that _fut_waiter continues on, and proceeds to set results etc. so that the calling tasks cannot distinguish this from a CancellationError which has been deliberately caught. I hope this explanation is a bit clearer than the first one. -- keywords: +patch Added file: http://bugs.python.org/file43397/asyncio_task_prints.patch ___ Python tracker <http://bugs.python.org/issue26923> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26971] python v3.5.1: sys.paths not respecting DESTDIRS and DESTSHARED
Johannes S. added the comment: I tried it again and I also tried 3.6.0a1 now. 3.6.0a1 has the issue as well. I have downloaded the tarballs from https://www.python.org/downloads/release/python-351/ and https://www.python.org/downloads/release/python-360a1/. I have run it on my Laptop (Arch Linux) now. The issue did *not* occur there. But I discovered that I can trigger a similar issue by specifying the libdir explicitly with `../configure --prefix="/some/dir" --libdir="/some/dir/lib64"`. I thing it would be reasonable to assume that both issues are related. -- versions: +Python 3.6 ___ Python tracker <http://bugs.python.org/issue26971> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26971] python v3.5.1: sys.paths not respecting DESTDIRS and DESTSHARED
Johannes Spangenberg added the comment: I can confirm this issue. I did run it on Linux SuSE 13.1 (64 Bit). Unlike other components, which are installed in `lib/`, `lib-dynload` is installed in `lib64/python3.5/`. But `sys.path` still points to `lib/python3.5/lib-dynload`. It did run in on : mkdir build cd build ../configure --prefix="${HOME}/.opt" nice -n 19 make -j 6 make install -- nosy: +Johannes Spangenberg ___ Python tracker <http://bugs.python.org/issue26971> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26923] asyncio.gather drops cancellation
Johannes Ebke added the comment: Thank you for providing the relevant documentation link. I just noticed that it should probably be clarified that in case the outer Future is cancelled, and all children that are not already done ignore the cancellation (a.k.a. catch the CancelledError), the cancellation of the outer Future does not continue. This is different to the behaviour of asyncio.wait_for, which always raises a CancelledError. -- ___ Python tracker <http://bugs.python.org/issue26923> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26923] asyncio.gather drops cancellation
New submission from Johannes Ebke: In a very specific case, asyncio.gather causes a cancel() call on the Task waiting on the _GatheringFuture to return a false positive. An example program demonstrating this is attached. The context: asyncio.gather creates a _GatheringFuture with a list of child Futures. Each child Future carries a done callback that updates the _GatheringFuture, and once the last child done callback is executed, the _GatheringFuture sets its result. The specific situation: When the last child future changes state to done it schedules its done callbacks, but does not immediately execute them. If the Task waiting on the gather is then cancelled before the last child done callback has run, the cancel method in asyncio/tasks.py:578 determines that the _GatheringFuture inspects itself and sees that it is not done() yet, and proceeds to cancel all child futures - which has no effect, since all of them are already done(). It still returns True, so the Tasks thinks all is well, and proceeds with its execution. The behaviour I would expect is that if cancel() is called on the _GatheringFuture, and all children return False on cancel(), then _GatheringFuture.cancel() should also return False, i.e.: def cancel(self): if self.done(): return False at_least_one_child_cancelled = False for child in self._children: if child.cancel(): at_least_one_child_cancelled = True return at_least_one_child_cancelled If I replace _GatheringFuture.cancel with the above variant, the bug disappears for me. More context: We hit this bug sporadically in an integration test of aioredis, where some timings conspired to make it appear with a chance of about 1 in 10. The minimal example calls the cancellation in a done_callback, so that it always hits the window. This was not the way the bug was discovered. -- components: asyncio files: cancellation_test.py messages: 264719 nosy: JohannesEbke, gvanrossum, haypo, yselivanov priority: normal severity: normal status: open title: asyncio.gather drops cancellation type: behavior versions: Python 3.5 Added file: http://bugs.python.org/file42694/cancellation_test.py ___ Python tracker <http://bugs.python.org/issue26923> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue25290] csv.reader: minor docstring typo
New submission from Johannes Niediek: docstring ends with colon, should be fullstop. -- components: Library (Lib) files: csvreader_docstring.txt messages: 252030 nosy: wasserverein priority: normal severity: normal status: open title: csv.reader: minor docstring typo type: enhancement versions: Python 2.7, Python 3.6 Added file: http://bugs.python.org/file40648/csvreader_docstring.txt ___ Python tracker <http://bugs.python.org/issue25290> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21345] multiprocessing.Pool._handle_workers sleeps too long
New submission from Johannes Baiter: While testing a module that uses multiprocessing.Pool to distribute load across multiple processes, I noticed that my test suite was copmleting very quickly (~0.15s) on Python 2.6, while Python 2.7 and above took around 10x as long (~1.6s). Upon debugging this, I pinned the slowdown down to the 'Pool.join()' method. Removing it removed the slowdown almost completely. I then checked the version history of the 'multiprocessing.pool' module between 2.6 and 2.7 and noticed that when the 'maxtasksperchild' parameter was introduced, a thread to handle the workers was introduced, which was 'join()'ed when the pool was joined. This is the function that is executed in the thread (from latest CPython checkout): @staticmethod def _handle_workers(pool): thread = threading.current_thread() # Keep maintaining workers until the cache gets drained, unless the pool # is terminated. while thread._state == RUN or (pool._cache and thread._state != TERMINATE): pool._maintain_pool() time.sleep(0.1) # <-- Cause of slow 'join()' after 2.6 # send sentinel to stop workers pool._taskqueue.put(None) util.debug('worker handler exiting') I highlighted the portion that makes 'join()' take a rather long time with short-lived processes in Python 2.7 and greater. Replacing it with 'time.sleep(0)' (as is done in '_help_stuff_finish()' later in the module) makes joining go as fast as in 2.6. Is there a specific reason why this sleep period was chosen? -- components: Library (Lib) messages: 217129 nosy: Johannes.Baiter priority: normal severity: normal status: open title: multiprocessing.Pool._handle_workers sleeps too long type: performance versions: Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.4, Python 3.5 ___ Python tracker <http://bugs.python.org/issue21345> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20968] mock.MagicMock does not mock __truediv__
Johannes Baiter added the comment: Sorry for commenting so late, I submitted a version of the patch with unit tests roughly two weeks ago, I just forgot to mention it in a comment. Hereby fixed :-) -- ___ Python tracker <http://bugs.python.org/issue20968> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20968] mock.MagicMock does not mock __truediv__
Changes by Johannes Baiter : Added file: http://bugs.python.org/file34515/mock_truediv_with_tests.diff ___ Python tracker <http://bugs.python.org/issue20968> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20968] mock.MagicMock does not mock __truediv__
Johannes Baiter added the comment: >From looking at 'test_numerics', only 'add' is currently tested. Probably since the mechanism for all of the numeric magic methods is the same (i.e. create , __i__, __r__). Should I add a test for __truediv__ and its inplace and right variants nonetheless? -- ___ Python tracker <http://bugs.python.org/issue20968> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20968] mock.MagicMock does not mock __truediv__
Johannes Baiter added the comment: I just noticed that I put the magic method names in the wrong place in the patch. Attached is a fix that adds 'truediv' to the global 'numberics' variable, this way '__rtruediv__' and '__itruediv__' will be correctly mocked as well. -- Added file: http://bugs.python.org/file34491/mock_truediv_numerics.diff ___ Python tracker <http://bugs.python.org/issue20968> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20968] mock.MagicMock does not mock __truediv__
Johannes Baiter added the comment: Attached is a patch that fixes the issue for me. -- keywords: +patch Added file: http://bugs.python.org/file34490/mock_truediv.diff ___ Python tracker <http://bugs.python.org/issue20968> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20968] mock.MagicMock does not mock __truediv__
New submission from Johannes Baiter: It seems that when creating a MagicMock the magic '__truediv__' method is not replaced with a mock: >>> import mock >>> foo = mock.MagicMock() >>> foo / 2 Traceback (most recent call last): File "", line 1, in TypeError: unsupported operand type(s) for /: 'MagicMock' and 'int' The same thing works perfectly fine when using the third party module in Python 2.7, since the 2.x '__div__' seems to be mocked: >>> import mock >>> foo = mock.MagicMock() >>> foo/2 To clarify the context, I am trying to mock a 'pathlib.Path' object in my unittest, which overloads the division operator, i.e. implements '__truediv__'. -- components: Library (Lib) messages: 213964 nosy: Johannes.Baiter priority: normal severity: normal status: open title: mock.MagicMock does not mock __truediv__ type: behavior versions: Python 3.4 ___ Python tracker <http://bugs.python.org/issue20968> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17260] Seg fault when calling unicode() on old style object in virtualenv
Johannes added the comment: Program received signal EXC_BAD_ACCESS, Could not access memory. Reason: KERN_INVALID_ADDRESS at address: 0x0008 0x00010004e221 in PyObject_GetAttr () (gdb) bt #0 0x00010004e221 in PyObject_GetAttr () #1 0x00010004e0ff in PyObject_Unicode () #2 0x00010007ee57 in unicode_new () #3 0x000100063cbc in type_call () #4 0x0001000108d1 in PyObject_Call () #5 0x0001000a5a1a in PyEval_EvalFrameEx () #6 0x0001000a313f in PyEval_EvalCodeEx () #7 0x0001000a2916 in PyEval_EvalCode () #8 0x0001000c9e2e in PyRun_FileExFlags () #9 0x0001000c980a in PyRun_SimpleFileExFlags () #10 0x0001000ded8a in Py_Main () #11 0x00010e4a in ?? () #12 0x00010d51 in ?? () -- ___ Python tracker <http://bugs.python.org/issue17260> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17260] Seg fault when calling unicode() on old style object in virtualenv
Changes by Johannes : -- title: Seg fault when calling unicode() on old style class in virtualenv -> Seg fault when calling unicode() on old style object in virtualenv ___ Python tracker <http://bugs.python.org/issue17260> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17260] Seg fault when calling unicode() on old style class in virtualenv
New submission from Johannes: Running the code attached causes a segmentation fault. This only occurs when run from within a virtual environment, and when the class is an old style class. I've tested on OSX with both 2.7.3 installed via Homebrew, and the default 2.7.2 Python installation. Also got the same result testing with 2.7.3 on linux ([GCC 4.4.5] on linux2) I've verified that exactly the same Python installation is being used inside and outside of the virtual env. Running the same code under 2.5 and 2.6 results in no seg fault. -- components: Unicode files: unicode-bug.py messages: 182562 nosy: ezio.melotti, johtso priority: normal severity: normal status: open title: Seg fault when calling unicode() on old style class in virtualenv type: crash versions: Python 2.7 Added file: http://bugs.python.org/file29136/unicode-bug.py ___ Python tracker <http://bugs.python.org/issue17260> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14547] Python symlink to script behaves unexpectedly
New submission from Johannes Buchner : If I have a script foo/bar.py import baz and create a symlink to it, called barhere.py ln -s foo/bar.py barhere.py when I run it, it behaves unexpectedly, specifically it behaves differently than if I had copied it here. It prefers to import baz from foo/baz, not from the current folder. Apparently Python (2.7.2-r3) handles symlinks differently than just looking at the content (everything is a file philosophy in UNIX). -- messages: 158039 nosy: j13r priority: normal severity: normal status: open title: Python symlink to script behaves unexpectedly ___ Python tracker <http://bugs.python.org/issue14547> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13498] os.makedirs exist_ok documentation is incorrect, as is some of the behavior
Johannes Kolb added the comment: I want to mention a situation in which the current behaviour of os.makedirs is confusing. At the first glance I would expect that if >>> os.makedirs(path) succeeds, then a following call to >>> os.makedirs(path, exist_ok=True) will succeed too. This is not always the case. Consider this (assuming Linux as OS and the umask set to 0o022): >>> os.makedirs('/tmp/mytest') >>> os.chmod('/tmp/mytest', 0o2755) >>> path='/tmp/mytest/dir1' >>> os.makedirs(path) >>> os.makedirs(path, exist_ok=True) OSError: [Errno 17] File exists: '/tmp/mytest/dir1' The directory '/tmp/mytest' here has the SETGID flag set, which is inherited automatically. Therefore the flags of '/tmp/mytest/dir1' are not 0o755 as expected by os.makedirs, but 0o2755. The same problem occurs if the user can changes the umask between the calls to os.makedirs. I wonder in what situation the current behaviour of os.makedirs is really helpful and not introducing subtle bugs. Consider using os.makedirs to ensure that the output directory of your script exists. Now the user decides to make this output directory world writeable. For most cases this is no problem, but os.makedirs will complain. -- nosy: +jokoala ___ Python tracker <http://bugs.python.org/issue13498> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14224] packaging: path description of resources is mixed up
New submission from Johannes Kolb : The documentation for "files" section of the setup.cfg file causes confusion: The examples don't match the description. Obviously the order of "destination" and "source" part in the generated filenames was mixed up in some places. -- assignee: docs@python components: Documentation files: packaging-docfixes.diff keywords: patch messages: 155123 nosy: docs@python, jokoala priority: normal severity: normal status: open title: packaging: path description of resources is mixed up type: behavior versions: Python 3.3 Added file: http://bugs.python.org/file24754/packaging-docfixes.diff ___ Python tracker <http://bugs.python.org/issue14224> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13940] imaplib: Mailbox names are not quoted
New submission from Johannes Bauer : imaplib does not qupote mailbox names when it's sending it's query to the server in response to a status request, for example. This will lead to very strange errors if mailboxes are accessed which contain spaces: i.e. connection.status("mailbox name", "(MESSAGES)") will return File "/home/joe/test/imaplib.py", line 920, in _command_complete raise self.error('%s command error: %s %s' % (name, typ, data)) imaplib.error: STATUS command error: BAD [b'Error in IMAP command STATUS: Status items must be list.'] which indicates that the error is within the actual flag list. It is not, however: connection.status("\"mailbox name\"", "(MESSAGES)") works as expected. This may arguably be or not be a bug -- however it is REALLY confusing to the user. Maybe at least a note should be included somewhere that -- just to be safe -- mailbox names should be quoted. All the best, Joe -- components: Library (Lib) messages: 152612 nosy: joebauer priority: normal severity: normal status: open title: imaplib: Mailbox names are not quoted type: behavior versions: Python 3.1 ___ Python tracker <http://bugs.python.org/issue13940> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13700] imaplib.IMAP4.authenticate authobject fails with PLAIN mechanism
Johannes Bauer added the comment: Issue also affects Python3.1. Hunk succeeds against 3.1 imaplib.py and works for me. -- nosy: +joebauer versions: +Python 3.1 ___ Python tracker <http://bugs.python.org/issue13700> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3244] multipart/form-data encoding
Johannes Hoff added the comment: Forest Bond: Thanks for this patch - I hope it will go in soon. In the meantime, could I get permission to use it as is? (I notice there is a copyright in the file) I would of course keep the attributions in the file. -- nosy: +Johannes.Hoff ___ Python tracker <http://bugs.python.org/issue3244> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11623] Distutils is reporting OSX 10.6 w/ XCode 4 as "universal"
New submission from Johannes Lindenbaum : This bug is a crosspost from /setuptools. (http://bugs.python.org/setuptools/issue122) Summary: OSX 10.6.x with Xcode 4 installed. Xcode 4 removes the PPC assembler from GCC. I attempted to install Fabric-1.0.0 which depended on pycrypto, during the pycrypto build there was a failure regarding "Broken Pipe". I downloaded the package separately and attempted to do the install there. Same error. I was pointed in the right direction that the broken pipe error was coming from the '-arch ppc' flag during build. Expected Result 10.6.x should not report itself as "universal" when it's no longer possible to compile for PPC. Actual Result Attempted PPC compilation fails. More detail: http://superuser.com/questions/259278/python-2-6-1-pycrypto-2-3-pypi-package-broken-pipe-during-build/260106#260106 Let me know if you require more information. Kind Regards, Johannes -- assignee: tarek components: Distutils messages: 131673 nosy: eric.araujo, jlindenbaum, tarek priority: normal severity: normal status: open title: Distutils is reporting OSX 10.6 w/ XCode 4 as "universal" type: behavior versions: Python 2.6 ___ Python tracker <http://bugs.python.org/issue11623> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7769] SimpleXMLRPCServer.SimpleXMLRPCServer.register_function as decorator
Johannes Schönberger added the comment: sorry, I totally forgot about this... -- ___ Python tracker <http://bugs.python.org/issue7769> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11209] Example for itertools.count is misleading
New submission from Johannes Ammon : The example code for itertools.count (http://docs.python.org/library/itertools.html#itertools.count) says # count(2.5, 0.5) -> 3.5 3.0 4.5 ... I think that should read # count(2.5, 0.5) -> 2.5 3.0 3.5 ... -- assignee: docs@python components: Documentation messages: 128533 nosy: docs@python, jammon priority: normal severity: normal status: open title: Example for itertools.count is misleading versions: Python 2.7 ___ Python tracker <http://bugs.python.org/issue11209> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10417] unittest triggers UnicodeEncodeError with non-ASCII character in the docstring of the test function
Johannes Ammon added the comment: Same behaviour with 2.7 -- versions: +Python 2.7 ___ Python tracker <http://bugs.python.org/issue10417> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10417] unittest triggers UnicodeEncodeError with non-ASCII character in the docstring of the test function
New submission from Johannes Ammon : When there is a non-ASCII character in the docstring of a test function, unittest triggers an UnicodeEncodeError when called with "--verbose". I have this file unicodetest.py: - # -*- coding: utf-8 -*- import unittest class UnicodeTest(unittest.TestCase): def test_unicode_docstring(self): u"""täst - docstring with unicode character""" self.assertEqual(1+1, 2) if __name__ == '__main__': unittest.main() - Running it normally is ok: $ python unicodetest.py . -- Ran 1 test in 0.000s OK But with "--verbose" it breaks: $ python unicodetest.py --verbose Traceback (most recent call last): File "unicodetest.py", line 10, in unittest.main() File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/unittest.py", line 817, in __init__ self.runTests() File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/unittest.py", line 861, in runTests result = testRunner.run(self.test) File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/unittest.py", line 753, in run test(result) File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/unittest.py", line 464, in __call__ return self.run(*args, **kwds) File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/unittest.py", line 460, in run test(result) File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/unittest.py", line 464, in __call__ return self.run(*args, **kwds) File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/unittest.py", line 460, in run test(result) File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/unittest.py", line 300, in __call__ return self.run(*args, **kwds) File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/unittest.py", line 266, in run result.startTest(self) File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/unittest.py", line 693, in startTest self.stream.write(self.getDescription(test)) UnicodeEncodeError: 'ascii' codec can't encode character u'\xe4' in position 1: ordinal not in range(128) Found with Python 2.6 on MacOS X 10.6.4 -- components: Tests, Unicode messages: 121193 nosy: jammon priority: normal severity: normal status: open title: unittest triggers UnicodeEncodeError with non-ASCII character in the docstring of the test function type: behavior versions: Python 2.6 ___ Python tracker <http://bugs.python.org/issue10417> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7770] sin/cos function in decimal-docs
Johannes Schönberger added the comment: sorry, forgot the str: def rsin(x): """Return the sine of x as measured in radians. >>> print sin(Decimal('0.5')) 0.4794255386042030002732879352 >>> print sin(0.5) 0.479425538604 >>> print sin(0.5+0j) (0.479425538604+0j) """ getcontext().prec += 2 if not isinstance(x, Decimal): x = Decimal(str(x)) x = x.remainder_near(2*pi()) i, lasts, s, fact, num, sign = 1, 0, x, 1, x, 1 while s != lasts: lasts = s i += 2 fact *= i * (i-1) num *= x * x sign *= -1 s += num / fact * sign getcontext().prec -= 2 return +s -- ___ Python tracker <http://bugs.python.org/issue7770> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7770] sin/cos function in decimal-docs
Johannes Schönberger added the comment: This adds two further lines, so you can pass int's, float's or Decimal types to the function. def sin(x): """Return the sine of x as measured in radians. >>> print sin(Decimal('0.5')) 0.4794255386042030002732879352 >>> print sin(0.5) 0.479425538604 >>> print sin(0.5+0j) (0.479425538604+0j) """ getcontext().prec += 2 if not isinstance(x, Decimal): x = Decimal(x) x = x.remainder_near(2*pi()) i, lasts, s, fact, num, sign = 1, 0, x, 1, x, 1 while s != lasts: lasts = s i += 2 fact *= i * (i-1) num *= x * x sign *= -1 s += num / fact * sign getcontext().prec -= 2 return +s -- ___ Python tracker <http://bugs.python.org/issue7770> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7769] SimpleXMLRPCServer.SimpleXMLRPCServer.register_function as decorator
Johannes Schönberger added the comment: OK, will work on it and reply as soon as I have results! -- ___ Python tracker <http://bugs.python.org/issue7769> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7769] SimpleXMLRPCServer.SimpleXMLRPCServer.register_function as decorator
Johannes Schönberger added the comment: OK, thank you for the links! Do you still want me to do anything (like test cases etc.)? -- ___ Python tracker <http://bugs.python.org/issue7769> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7769] SimpleXMLRPCServer.SimpleXMLRPCServer.register_function as decorator
Johannes Schönberger added the comment: I'm not very used to working with bug/issue trackers, is there any tutorial here, where this is explained? I did the stuff you asked me to do: diff: http://paste.pocoo.org/compare/169357/169359/ test: http://paste.pocoo.org/show/169360/ -- ___ Python tracker <http://bugs.python.org/issue7769> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7770] sin/cos function in decimal-docs
Johannes Schönberger added the comment: stupid, it is much better to just use the modulo operator. The same works with cos... def sin(x): """Return the sine of x as measured in radians. >>> print sin(Decimal('0.5')) 0.4794255386042030002732879352 >>> print sin(0.5) 0.479425538604 >>> print sin(0.5+0j) (0.479425538604+0j) """ x %= pi() getcontext().prec += 2 i, lasts, s, fact, num, sign = 1, 0, x, 1, x, 1 while s != lasts: lasts = s i += 2 fact *= i * (i-1) num *= x * x sign *= -1 s += num / fact * sign getcontext().prec -= 2 return +s def cos(x): """Return the cosine of x as measured in radians. >>> print cos(Decimal('0.5')) 0.8775825618903727161162815826 >>> print cos(0.5) 0.87758256189 >>> print cos(0.5+0j) (0.87758256189+0j) """ x %= pi() getcontext().prec += 2 i, lasts, s, fact, num, sign = 0, 0, 1, 1, 1, 1 while s != lasts: lasts = s i += 2 fact *= i * (i-1) num *= x * x sign *= -1 s += num / fact * sign getcontext().prec -= 2 return +s -- ___ Python tracker <http://bugs.python.org/issue7770> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7770] sin/cos function in decimal-docs
Johannes Schönberger added the comment: This is the version I would suggest and which is quite accurate unless the numbers get extremely large. def sin(x): """Return the sine of x as measured in radians. >>> print sin(Decimal('0.5')) 0.4794255386042030002732879352 >>> print sin(0.5) 0.479425538604 >>> print sin(0.5+0j) (0.479425538604+0j) """ x = x - pi()*int(x / pi()) getcontext().prec += 2 i, lasts, s, fact, num, sign = 1, 0, x, 1, x, 1 while s != lasts: lasts = s i += 2 fact *= i * (i-1) num *= x * x sign *= -1 s += num / fact * sign getcontext().prec -= 2 return +s -- ___ Python tracker <http://bugs.python.org/issue7770> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7770] sin/cos function in decimal-docs
New submission from Johannes Schönberger : Unfortunately the sin/cos function in the decimal docs seems to return false results. In [33]: sin(decimal.Decimal('75')) Out[33]: Decimal('0.377879483645203210442266845614') In [34]: sin(decimal.Decimal('76')) Out[34]: Decimal('-2.08828460009724889326220807212') In [42]: sin(decimal.Decimal('100')) Out[42]: Decimal('-58433045378.5877442230422602000') # In [37]: cos(decimal.Decimal('79')) Out[37]: Decimal('-14.3603762068086273628189466621') In [38]: cos(decimal.Decimal('77')) Out[38]: Decimal('-13.6219693138941571794243404126') In [39]: cos(decimal.Decimal('75')) Out[39]: Decimal('1.25761570869417008177315814688') In [40]: cos(decimal.Decimal('72')) Out[40]: Decimal('-1.02323683857735456186757099584') -- assignee: georg.brandl components: Documentation messages: 98221 nosy: ahojnnes, georg.brandl severity: normal status: open title: sin/cos function in decimal-docs type: behavior versions: Python 2.6 ___ Python tracker <http://bugs.python.org/issue7770> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7769] SimpleXMLRPCServer.SimpleXMLRPCServer.register_function as decorator
New submission from Johannes Schönberger : I would suggest to make SimpleXMLRPCServer.SimpleXMLRPCServer.register_function a decorator function. See the attached file for the solution I wrote (l.209-240), which also works with the current syntax: @server.register_function @server.register_function('name') @server.register_function(name='name') or: server.register_function(func) server.register_function(func, name='name') server.register_function(function=func, name='name') So as far as I've tested it (py2.6), it is fully backwards compatible and supports decorators in addition. -- components: Extension Modules files: SimpleXMLRPCServer.py messages: 98219 nosy: ahojnnes severity: normal status: open title: SimpleXMLRPCServer.SimpleXMLRPCServer.register_function as decorator type: feature request versions: Python 2.6 Added file: http://bugs.python.org/file15986/SimpleXMLRPCServer.py ___ Python tracker <http://bugs.python.org/issue7769> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6712] sys._getframe is not available on all Python implementations
New submission from Johannes Janssen : As I learned on the mailing list the function sys._getframe() is not available on all Python implementations (e.g. jython). This information should be added to the documentation. -- assignee: georg.brandl components: Documentation messages: 91629 nosy: georg.brandl, johannes.janssen severity: normal status: open title: sys._getframe is not available on all Python implementations ___ Python tracker <http://bugs.python.org/issue6712> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5611] Auto-detect indentation in C source in vimrc
Johannes Hoff added the comment: I came across this bug while searching for autodetecting tabs/spaces. Thanks for the help. To address Georg's question, the patch should be modified to say if search('^\t', 'n', 100) instead of if search('^\t') The former will not move the cursor, and will only search the first 100 lines. -- nosy: +johshoff ___ Python tracker <http://bugs.python.org/issue5611> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5996] abstract class instantiable when subclassing dict
New submission from johannes raggam : when declaring a abstract base class with an abstract property or method and subclassing from dict, the class is instantiable (instanceable?). >>> import abc >>> class A(object): ... __metaclass__ = abc.ABCMeta ... @abc.abstractproperty ... def abstract(self): return True ... >>> a = A() Traceback (most recent call last): File "", line 1, in TypeError: Can't instantiate abstract class A with abstract methods abstract >>> >>> class A2(dict): ... __metaclass__ = abc.ABCMeta ... @abc.abstractproperty ... def abstract(self): return True ... >>> a2 = A2() >>> although, when using the dict definition from __builtin__.pi directly, the abc behaves like expected. but this may be a bug in the c-implementation from dict. platform: Python 2.6.2 (r262:71600, Apr 25 2009, 21:56:41) [GCC 4.3.2] on linux2 -- components: Library (Lib) messages: 87574 nosy: thet severity: normal status: open title: abstract class instantiable when subclassing dict type: behavior versions: Python 2.6 ___ Python tracker <http://bugs.python.org/issue5996> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1297] pyconfig.h not compatible with MS VC++ Express Edition
Johannes Hoff <[EMAIL PROTECTED]> added the comment: This is still the case with Visual Studio Express 2008. It can be fixed by downloading the Windows SDK, though it would be nicer if this was not necessary. Download link: http://blogs.msdn.com/windowssdk/archive/2008/02/07/ windows-sdk-rtms.aspx I recommend the "web install", since only the headers and libraries are needed, not the whole 1GB blob that comes with it. Amaury: The file python.hpp, thus basetsd.h, is used by boost-python. -- nosy: +johanneshoff __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1297> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com