[issue19933] Round default argument for ndigits

2013-12-09 Thread Mark Dickinson

Mark Dickinson added the comment:

 After patch:
 round(1.23, 0) = 1 not 1.0
 round(4.67, 0) = 5 not 5.0

Please no!  Two-argument round should continue to return a float in all cases.

The docs should be fixed.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19933
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19933] Round default argument for ndigits

2013-12-09 Thread Mark Dickinson

Mark Dickinson added the comment:

 But also there should be a way to make round return an integer

I don't understand.  There's already a way to make round return an integer: 
don't pass a second argument.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19933
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19933] Round default argument for ndigits

2013-12-09 Thread Vajrasky Kok

Changes by Vajrasky Kok sky@speaklikeaking.com:


Added file: http://bugs.python.org/file33053/fix_doc_round_ndigits.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19933
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19933] Round default argument for ndigits

2013-12-09 Thread Vajrasky Kok

Vajrasky Kok added the comment:

Okay, here is the patch to fix the doc.

--
Added file: http://bugs.python.org/file33052/fix_doc_round_ndigits.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19933
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19933] Round default argument for ndigits

2013-12-09 Thread Vajrasky Kok

Changes by Vajrasky Kok sky@speaklikeaking.com:


Removed file: http://bugs.python.org/file33052/fix_doc_round_ndigits.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19933
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19933] Round default argument for ndigits

2013-12-09 Thread Vajrasky Kok

Changes by Vajrasky Kok sky@speaklikeaking.com:


Removed file: http://bugs.python.org/file33053/fix_doc_round_ndigits.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19933
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19933] Round default argument for ndigits

2013-12-09 Thread Vajrasky Kok

Changes by Vajrasky Kok sky@speaklikeaking.com:


Added file: http://bugs.python.org/file33054/fix_doc_round_ndigits.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19933
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19846] Setting LANG=C breaks Python 3 on Linux

2013-12-09 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

 And yet, in Python 2, people could do that, and Python didn't care.
 *That's* the regression I'm worried about. If it hadn't round-tripped
 cleanly in Python 2, I wouldn't care here either.

$ python2.7 -c print u'\u20ac'
€
$ LANG=C python2.7 -c print u'\u20ac'
Traceback (most recent call last):
  File string, line 1, in module
UnicodeEncodeError: 'ascii' codec can't encode character u'\u20ac' in position 
0: ordinal not in range(128)

And even worse:

$ python2.7 -c print u'\u20ac' /dev/null
Traceback (most recent call last):
  File string, line 1, in module
UnicodeEncodeError: 'ascii' codec can't encode character u'\u20ac' in position 
0: ordinal not in range(128)

What the wart!

Other program can produces wrong (or even absolutely senseless) output with C 
locale.

$ LANG=C ls
   
 ??
?? ??  
?? 
??  
??
?? ??   


What is better, silently produce corrupted output or raise an exception? If 
first, then let just set the replace or backslashreplace error handler for 
sys.stdout by default.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19846
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19846] Setting LANG=C breaks Python 3 on Linux

2013-12-09 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

 sworddragon@ubuntu:~$ LANG=C
 sworddragon@ubuntu:~$ ä
 bash: $'\303\244': command not found
 
 - The terminal doesn't pseudo-crash with an exception because it doesn't
 matter about encodings. - It allows to change the encoding at runtime.

This is not a locale of your terminal. Try `LANG=C xterm`.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19846
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18576] Rename and document test.script_helper as test.support.script_helper

2013-12-09 Thread Fotis Koutoulakis

Fotis Koutoulakis added the comment:

Hello again.

Is everything ok with the patch? Is there something not working as expected? 
Perhaps an omission or something? Do I need to do something more to get it 
accepted?

Thanks for your time.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18576
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19935] IPv6 urlparse error on python 2.6

2013-12-09 Thread Yu Yang

New submission from Yu Yang:

Actually, there is a bug which has been fixed this issue on python 2.7 and 
python 3.3. http://bugs.python.org/issue2987. Open this issue aims for back 
port this fix to python 2.6.

--
components: Library (Lib)
messages: 205657
nosy: yuyangbj
priority: normal
severity: normal
status: open
title: IPv6 urlparse error on python 2.6
type: enhancement
versions: Python 2.6

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19935
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19915] int.bit_at(n) - Accessing a single bit in O(1)

2013-12-09 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

 For example, `i.bits_at(0, 52)` to get at a double's mantissa requires no 
 thought at all to write or to read later; bit-level gibberish like

I agree that special function or method looks more clear. But I suppose that in 
many cases the performance does matter. And function call has larger overhead 
in current Python.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19915
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19935] IPv6 urlparse error on python 2.6

2013-12-09 Thread Christian Heimes

Christian Heimes added the comment:

Python 2.6 has reached its end of life cycle and doesn't receive fixes anymore. 
You have to maintain a bugfix yourself or update to a more recent version of 
Python.

--
nosy: +christian.heimes
resolution:  - out of date
stage:  - committed/rejected
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19935
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19935] IPv6 urlparse error on python 2.6

2013-12-09 Thread Yu Yang

Yu Yang added the comment:

As the OpenStack support python 2.6, python 2.7 and python 3.3, and IPv6 
management network is supported by OpenStack, so we need to back port urlparse 
problem for IPv6 to python 2.6, otherwise there will be limitation on python 2.6

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19935
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18576] Rename and document test.script_helper as test.support.script_helper

2013-12-09 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Please left test.script_helper as alias to test.support.script_helper.

I.e. test/script_helper.py should contains something like:

from test.support.script_helper import *

And test this with unmodifiable other tests.

--
nosy: +serhiy.storchaka

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18576
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19935] IPv6 urlparse error on python 2.6

2013-12-09 Thread Yu Yang

Yu Yang added the comment:

@Christian Heimes, thanks for your response.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19935
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19846] Setting LANG=C breaks Python 3 on Linux

2013-12-09 Thread Marc-Andre Lemburg

Marc-Andre Lemburg added the comment:

The C locale is part of the ANSI C standard. The POSIX locale is an alias 
for the C locale and a POSIX standard, so we cannot just replace the ASCII 
encoding with UTF-8 as we wish, so Antoine's patch won't work.

See e.g. http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap07.html

The C and POSIX locale settings are the only locale settings that are 
guaranteed to always exist in C libraries. Python 3 should work with such 
locale settings. It doesn't have to be able to output non-ASCII code points, 
but it should run with ASCII data.

AFAIK, Python 3 does work with ASCII data in the C locale, so I'm not sure 
whether this is a bug at all.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19846
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19846] Setting LANG=C breaks Python 3 on Linux

2013-12-09 Thread STINNER Victor

STINNER Victor added the comment:

I didn't understand Serhiy's ls example. I tried:

$ mkdir unicode
$ cd unicode
$ python3 -c 'open(ab\xe9.txt, w).close()'
$ python3 -c 'open(euro\u20ac.txt, w).close()'
$ ls
abé.txt  euro€.txt
$ LANG=C ls
ab??.txt  euro???.txt


Ah yes, I didn't remember that ls is aware of the locale encoding.

printf() and wprintf() behave differently on unencodable/undecoable characters:
http://unicodebook.readthedocs.org/en/latest/programming_languages.html#printf-functions-family

Again, the issue is not specific to Python. So it's time to learn how to 
configure correctly your locales.

About the interoperability point I mentionned in my first message (This 
encoding is the best choice for interopability with other (python2 or non 
python) programs.): if you work around the annoying ASCII encoding by forcing 
UTF-8 encoding, Python may produce data which would be incompatible with other 
applications following POSIX and so using the ASCII encoding.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19846
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19846] Setting LANG=C breaks Python 3 on Linux

2013-12-09 Thread STINNER Victor

STINNER Victor added the comment:

Nick testing applications for POSIX compliance

Sorry but what do you mean by POSIX compliance? The POSIX standard only 
specify the ASCII encoding.

http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap07.html
The tables in Locale Definition describe the characteristics and behavior of 
the POSIX locale for data consisting entirely of characters from the portable 
character set and the control character set. For other characters, the behavior 
is unspecified. For C-language programs, the POSIX locale shall be the default 
locale when the setlocale() function is not called.

http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap06.html#tagtcjh_3
Portable character set = ASCII

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19846
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19846] Setting LANG=C breaks Python 3 on Linux

2013-12-09 Thread STINNER Victor

STINNER Victor added the comment:

Marc-Andre AFAIK, Python 3 does work with ASCII data in the C locale, so I'm 
not sure whether this is a bug at all.

What do you mean? Python uses the surrogateescape encoding since Python 3.1, 
undecodable bytes are stored as surrogate characters.

Many bugs related to locales were fixed in Python 3.2, 3.3 and 3.4.

There are remaining bugs?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19846
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19846] Setting LANG=C breaks Python 3 on Linux

2013-12-09 Thread Marc-Andre Lemburg

Marc-Andre Lemburg added the comment:

On 09.12.2013 11:19, STINNER Victor wrote:
 
 STINNER Victor added the comment:
 
 Marc-Andre AFAIK, Python 3 does work with ASCII data in the C locale, so I'm 
 not sure whether this is a bug at all.
 
 What do you mean? Python uses the surrogateescape encoding since Python 3.1, 
 undecodable bytes are stored as surrogate characters.
 
 Many bugs related to locales were fixed in Python 3.2, 3.3 and 3.4.
 
 There are remaining bugs?

I was referring to the original bug report on this ticket.

FWIW: I don't think you can expect Python to work without exceptions
if you use a C locale and write non-ASCII data to stdout. I also
don't think that the new ticket title is correct - or at least,
I fail to see which aspect of Python breaks with LANG=C :-)

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19846
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19542] WeakValueDictionary bug in setdefault()pop()

2013-12-09 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Changeset ea70032a24b1 is where the pop(*args) thing comes from.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19542
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19846] Python 3 raises Unicode errors with the C locale

2013-12-09 Thread STINNER Victor

STINNER Victor added the comment:

I'm closing the issue as invalid, because Python 3 behaviour is correct and 
must not be changed.


Standard streams (sys.stdin, sys.stdout, sys.stderr) uses the locale encoding. 
sys.stdin and sys.stdout use the strict error handler, sys.stderr uses the 
backslashreplace error handler. These encodings and error handlers can be 
overriden by the PYTHONIOENCODING. Since Python 3.3, it's possible to only set 
the error handler using :errors syntax (ex: PYTHONIOENCODING=:replace).


Python uses sys.getfilesystemencoding() to decode data from / encode data to 
the operating system. Example of operating system data: command line arguments, 
environment variables, host names, filenames, user names, etc.

On Windows, Python tries to use the wide character (Unicode) API of Windows 
anywhere to avoid any conversion, to not loose data. The MBCS codec (ANSI code 
page) of Windows uses a replace error handler by default, it looses data. Try 
for example os.listdir() in a directory containing filenames not encodable to 
the ANSI code page in Python 2 (or os.listdir(b'.') in Python 3).

On Mac OS X, Python always use UTF-8 for sys.getfilesystemencoding() (with the 
surrogateescape error handler, see the PEP 383). The locale encoding is ignored 
for sys.getfilesystemencoding() (the locale encoding is still used in some 
functions).

On other operating systems... it's more complex. Python uses the locale 
encoding for sys.getfilesystemencoding() (with the surrogateescape error 
handler, see the PEP 383). For the POSIX locale (aka the C locale), you may 
get the ASCII encoding on Linux, ASCII on FreeBSD and Solaris (whereas these 
operating systems announce an alias of the ISO 8859-1 encoding, but use ASCII 
in practice), ISO 8859-1 on AIX etc. Using the locale encoding is the best 
choice for interoperability with other applications (which use also the locale 
encoding).

Even if an application uses raw bytes (like Python 2), these bytes are still 
locale aware. For example, when raw bytes are written to the standard 
output, bytes are decoded to find the appropriate character in the font of the 
terminal. When raw bytes are written into a socket to generate a HTML 
document (ex: listing of a directory, so a list of filenames), the web brower 
will decode them from them encoding announced in the HTML page. Even if the 
encoding is not explicit, it does still exist. Read other comments of this 
issue for other examples.

Forcing the POSIX locale to get an user interface in english is wrong if you 
also expect from your application to still generate valid raw bytes in your 
system encoding (ISO 8859-1, ShiftJIS, UTF-8, whatever). To change the 
language, the correct environment variable is LC_CTYPE: use LC_CTYPE=C. Or 
better, use the real english locale which will probably handle better currency, 
numbers, etc. Example: LC_CTYPE=en_US.utf8 (on Fedora, en_US locale uses the 
ISO 8859-1 encoding).

--
resolution:  - invalid
status: open - closed
title: Setting LANG=C breaks Python 3 on Linux - Python 3 raises Unicode 
errors with the C locale
versions: +Python 3.3, Python 3.4 -Python 3.5

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19846
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18576] Rename and document test.script_helper as test.support.script_helper

2013-12-09 Thread Fotis Koutoulakis

Fotis Koutoulakis added the comment:

Ok, here is the second (modified patch) which contains a script so that no 
modifications are required to existing tests.

I am uploading it as a second patch, so that the first one is left as a 
reference.

As a sidenote, I fail to see convincing reasons for why we would want the 
second solution more than the first. The first one looks cleaner to my eyes. 
The only downside I can see to the original approach is breaking a couple of 
tests, which is something that can be fixed easily without even making it to 
the repo (running the tests in 2-3 could help find all possible broken tests 
beforehand).

Could someone explain to me why the second solution is more desirable?

--
Added file: http://bugs.python.org/file33055/issue_18576_second.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18576
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19936] Executable permissions of Python source files

2013-12-09 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

Following files have executable permission bit but have no shebang (#!):

Lib/test/ssltests.py
Lib/test/test_pathlib.py
Lib/token.py
Tools/scripts/analyze_dxp.py
Tools/scripts/run_tests.py
Tools/scripts/win_add2path.py
Tools/stringbench/stringbench.py

I think executable bit should be cleared on them, because they can't be ran 
without correct shebang.

Following files have shebang but have no executable permission bit:

Doc/includes/email-alternative.py
Doc/includes/email-dir.py
Doc/includes/email-unpack.py
Lib/difflib.py
Lib/http/cookies.py
Lib/idlelib/PyShell.py
Lib/lib2to3/tests/data/different_encoding.py
Lib/lib2to3/tests/data/false_encoding.py
Lib/mailbox.py
Lib/operator.py
Lib/smtplib.py
Lib/tarfile.py
Lib/test/_test_multiprocessing.py
Lib/test/crashers/recursive_call.py
Lib/test/curses_tests.py
Lib/test/multibytecodec_support.py
Lib/test/test___future__.py
Lib/test/test_bz2.py
Lib/test/test_cmd.py
Lib/test/test_codecencodings_cn.py
Lib/test/test_codecencodings_hk.py
Lib/test/test_codecencodings_iso2022.py
Lib/test/test_codecencodings_jp.py
Lib/test/test_codecencodings_kr.py
Lib/test/test_codecencodings_tw.py
Lib/test/test_codecmaps_cn.py
Lib/test/test_codecmaps_hk.py
Lib/test/test_codecmaps_jp.py
Lib/test/test_codecmaps_kr.py
Lib/test/test_codecmaps_tw.py
Lib/test/test_dbm.py
Lib/test/test_dbm_dumb.py
Lib/test/test_eof.py
Lib/test/test_gzip.py
Lib/test/test_keywordonlyarg.py
Lib/test/test_logging.py
Lib/test/test_marshal.py
Lib/test/test_multibytecodec.py
Lib/test/test_popen.py
Lib/test/test_random.py
Lib/test/test_sched.py
Lib/test/test_smtpnet.py
Lib/test/test_socket.py
Lib/test/test_support.py
Lib/test/test_tcl.py
Lib/test/test_urllib2_localnet.py
Lib/test/test_urllib2net.py
Lib/test/test_urllibnet.py
Lib/test/test_with.py
Lib/test/test_xmlrpc_net.py
Lib/timeit.py
Lib/trace.py
Lib/turtledemo/bytedesign.py
Lib/turtledemo/clock.py
Lib/turtledemo/forest.py
Lib/turtledemo/fractalcurves.py
Lib/turtledemo/lindenmayer.py
Lib/turtledemo/minimal_hanoi.py
Lib/turtledemo/paint.py
Lib/turtledemo/peace.py
Lib/turtledemo/penrose.py
Lib/turtledemo/planet_and_moon.py
Lib/turtledemo/tree.py
Lib/turtledemo/two_canvases.py
Lib/turtledemo/yinyang.py
Lib/webbrowser.py
Mac/Tools/bundlebuilder.py
Mac/Tools/plistlib_generate_testdata.py
Modules/_ctypes/libffi/generate-ios-source-and-headers.py
Modules/_ctypes/libffi/generate-osx-source-and-headers.py
Modules/_decimal/tests/bench.py
Modules/_decimal/tests/deccheck.py
Modules/_decimal/tests/randdec.py
Objects/typeslots.py
Tools/clinic/clinic_test.py
Tools/gdb/libpython.py
Tools/i18n/makelocalealias.py
Tools/pybench/Setup.py
Tools/pybench/clockres.py
Tools/pybench/systimes.py
Tools/scripts/checkpip.py
Tools/ssl/make_ssl_data.py
Tools/test2to3/maintest.py
Tools/unicode/comparecodecs.py
Tools/unittestgui/unittestgui.py

I think most of them should got executable bit.

Exceptions are:

Doc/includes/*.py  -- they are just examples, it can be dangerous set 
executable bit on files which can be exposed via http server.

Lib/test/test_*.py -- they don't purposed to ran with with default system 
Python. Shebangs should be removed.

Lib/test/_test_multiprocessing.py, Lib/test/multibytecodec_support.py -- they 
are just auxiliary modules for other tests. Shebangs should be removed.

Lib/http/cookies.py, Lib/mailbox.py, Lib/operator.py, 
Modules/_decimal/tests/randdec.py -- they don't do anything. Shebangs should be 
removed.

Tools/test2to3/maintest.py -- this is Python2 script with Python3 shebang.

Lib/difflib.py -- this just runs doctests. Shebang should be removed.

Following files have shebang but have no executable permission bit. Both should 
be removed.

Lib/test/test_array.py
Lib/test/test_binhex.py
Lib/test/test_errno.py
Lib/test/test_urlparse.py
Lib/test/test_userstring.py

In Tools/unittestgui/unittestgui.py python should be changed to python3 in 
the shebang.

Any thoughts?

--
assignee: serhiy.storchaka
components: Demos and Tools, Library (Lib)
files: executable_scripts.patch
keywords: patch
messages: 205677
nosy: serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Executable permissions of Python source files
type: behavior
versions: Python 2.7, Python 3.3, Python 3.4
Added file: http://bugs.python.org/file33056/executable_scripts.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19936
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19893] Python cApi memory problem. Py_Initialize memory leak

2013-12-09 Thread Roman

Roman added the comment:

I've checked it one more time.
And you're right (Sorry for trouble). I left old pyconfig.h in one place, so my 
new python compilation was not just what I wanted. 

Now I belive that everything with memory is ok. 

Thank you very much for your help.

--
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19893
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19817] tracemalloc add a memory limit feature

2013-12-09 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 45442f2a2494 by Victor Stinner in branch 'default':
Issue #19817: Fix print_exception(), clear the exception on error
http://hg.python.org/cpython/rev/45442f2a2494

--
nosy: +python-dev

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19817
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18576] Rename and document test.script_helper as test.support.script_helper

2013-12-09 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Third party code can use tests.script_helper.

I prefer to do these changes in several steps:

1) Move script_helper.py to Lib/test/support/, document it, and create an alias 
(with deprecation warning).
2) Ensure that this doesn't break any buildbot.
3) Change tests to use test.support.script_helper instead of test.script_helper.
4) One or two versions later remove an alias.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18576
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19893] Python cApi memory problem. Py_Initialize memory leak

2013-12-09 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@gmail.com:


--
resolution:  - invalid

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19893
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18576] Rename and document test.script_helper as test.support.script_helper

2013-12-09 Thread Fotis Koutoulakis

Fotis Koutoulakis added the comment:

Oh, I see. Does the last patch meet your expectations, or would you rather see 
all these changes implemented at once?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18576
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19933] Round default argument for ndigits

2013-12-09 Thread Mark Dickinson

Mark Dickinson added the comment:

Thanks.  It's inaccurate to say that a float is returned in general, though:  
for most builtin numeric types, what's returned has the same type as its input. 
 So rounding a Decimal to two places gives a Decimal on output, etc.  (That's 
already explained in the next paragraph.)

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19933
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19933] Round default argument for ndigits

2013-12-09 Thread Mark Dickinson

Mark Dickinson added the comment:

How about just removing the mention of 'defaults to zero', and say something 
like: if ndigits is omitted, returns the nearest int to its input

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19933
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18576] Rename and document test.script_helper as test.support.script_helper

2013-12-09 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

 Does the last patch meet your expectations, or would you rather see all these 
 changes implemented at once?

I left this for Nick.

I have added comments on Rietveld.

--
stage: needs patch - patch review

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18576
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4130] Intel icc 9.1 does not support __int128_t used by ctypes

2013-12-09 Thread Jens Timmerman

Jens Timmerman added the comment:

Since this is fixed in upstream libffi, can this be synced with the libffi 
included in python?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4130
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13492] ./configure --with-system-ffi=LIBFFI-PATH

2013-12-09 Thread Jens Timmerman

Jens Timmerman added the comment:

As a workaround, you can make the libffi build work by applying this patch.

https://github.com/atgreen/libffi/pull/43

(indeed, see also http://bugs.python.org/issue4130 )

--
nosy: +Jens.Timmerman

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13492
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19843] Wait for multiple sub-processes to terminate

2013-12-09 Thread Giampaolo Rodola'

Giampaolo Rodola' added the comment:

I replied to your comments here:
http://bugs.python.org/review/19843/
Assuming the deadlock problem gets fixed would you consider this feature worthy 
for inclusion?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19843
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19846] Python 3 raises Unicode errors with the C locale

2013-12-09 Thread Sworddragon

Sworddragon added the comment:

 I'm closing the issue as invalid, because Python 3 behaviour is correct  and 
 must not be changed.

The fact that write() uses sys.getfilesystemencoding() is either a defect or a 
bad design (I leave the decision to you).


But I'm still missing a reply to my suggestion. As I'm seeing it has no 
disadvantages to give the developer optionally the control.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19846
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18576] Rename and document test.script_helper as test.support.script_helper

2013-12-09 Thread Fotis Koutoulakis

Fotis Koutoulakis added the comment:

Taking the feedback during code review, this is a patch that has the points 
raised by Serhiy Storchaka fixed.

As always, please do note omission or mistakes from my part. Thanks for your 
help.

--
Added file: http://bugs.python.org/file33057/issue18576_third_try.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18576
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19846] Python 3 raises Unicode errors with the C locale

2013-12-09 Thread STINNER Victor

STINNER Victor added the comment:

 The fact that write() uses sys.getfilesystemencoding() is either a defect or 
 a bad design (I leave the decision to you).

Standard streams (sys.stdin, sys.stdout, sys.stderr) uses the locale encoding. 
sys.stdin and sys.stdout use the strict error handler, sys.stderr uses the 
backslashreplace error handler. These encodings and error handlers can be 
overriden by the PYTHONIOENCODING. Since Python 3.3, it's possible to only set 
the error handler using :errors syntax (ex: PYTHONIOENCODING=:replace).

stdout uses the locale encoding (and if you read my whole message, you may 
understand why sys.getfilesystemencoding() is also the locale encoding on UNIX).

(FYI on Windows, the OEM code page is used for standard streams.)

sys.getdefaultencoding() is always utf-8, this is unrelated to standard streams 
and OS data: it's the default value of the encoding parameter of str.encode() 
and str.decode(). I'm surprised that it's not documented to be utf-8, it is 
hardcoded and so always utf-8 in Python 3.

 But I'm still missing a reply to my suggestion. As I'm seeing it has no 
 disadvantages to give the developer optionally the control.

Standard streams (sys.stdin, sys.stdout, sys.stderr) uses the locale encoding. 
sys.stdin and sys.stdout use the strict error handler, sys.stderr uses the 
backslashreplace error handler. These encodings and error handlers can be 
overriden by the PYTHONIOENCODING. Since Python 3.3, it's possible to only set 
the error handler using :errors syntax (ex: PYTHONIOENCODING=:replace).

If the environment variable is not enough, see also #15216 which proposes to 
add a TextIOWrapper.set_encoding() method. (I'm not really a fan of this 
proposition, but it looks like some users ask for it.)

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19846
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19846] Python 3 raises Unicode errors with the C locale

2013-12-09 Thread Larry Hastings

Larry Hastings added the comment:

 The fact that write() uses sys.getfilesystemencoding() is either
 a defect or a bad design (I leave the decision to you).

I have good news for you.  write() does not cal sys.getfilesystemencoding(), 
because the encoding is set at the time the file is opened.


 But I'm still missing a reply to my suggestion. As I'm seeing it
 has no disadvantages to give the developer optionally the control.

The programmer has all the control they need.  They can open their own pipes 
using any encoding they like, and they can even reopen stdin/stdout with a 
different encoding if they wish.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19846
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19937] IDLE can't be launch

2013-12-09 Thread Ryan Z

New submission from Ryan Z:

After I installed a wrong version pygame on OSX 10.9, and may updated something 
OSX, Then, I can't launch the IDLE, 
It appears on the dock, then quit at the same moment.


bogon:~ RyanZ$ /usr/local/bin/python3.3 -m idlelib
Traceback (most recent call last):
  File 
/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/runpy.py, 
line 160, in _run_module_as_main
__main__, fname, loader, pkg_name)
  File 
/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/runpy.py, 
line 73, in _run_code
exec(code, run_globals)
  File 
/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/idlelib/__main__.py,
 line 9, in module
idlelib.PyShell.main()
  File 
/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/idlelib/PyShell.py,
 line 1572, in main
shell.interp.runcommand(''.join((print(', tkversionwarning, '
AttributeError: 'NoneType' object has no attribute 'interp'

--
assignee: ronaldoussoren
components: Macintosh
messages: 205692
nosy: Ryan.Z, ronaldoussoren
priority: normal
severity: normal
status: open
title: IDLE can't be launch
type: compile error
versions: Python 3.3

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19937
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19846] Python 3 raises Unicode errors with the C locale

2013-12-09 Thread Sworddragon

Sworddragon added the comment:

 If the environment variable is not enough

There is a big difference between environment variables and internal calls: 
Environment variables are user-space while builtin/library functions are 
developer-space.


 I have good news for you.  write() does not cal 
 sys.getfilesystemencoding(), because the encoding is set at the time  the 
 file is opened.

Thanks for the clarification. I wished somebody had sayed me that after this 
sentence in my startpost: It seems that print() and write() (and maybe other 
of such I/O functions) are relying on sys.getfilesystemencoding().


In theory this makes already my ticket invalid. Well, but now I would wish 
print() would allow to choose the encoding like open() too^^

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19846
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19846] Python 3 raises Unicode errors with the C locale

2013-12-09 Thread STINNER Victor

STINNER Victor added the comment:

 There is a big difference between environment variables and internal calls: 
 Environment variables are user-space while builtin/library functions are 
 developer-space.

You can reopen sys.stdout with a different encoding and replace sys.stdout. I 
don't remember the exact recipe, it's tricky if you want portable code (you 
have to take care of newline).

For example, I wrote:
http://hg.python.org/cpython/file/ebe28dba4a78/Lib/test/regrtest.py#l895

But you can avoid reopening the file using stdout.detach().

 In theory this makes already my ticket invalid. Well, but now I would wish 
 print() would allow to choose the encoding like open() too^^

Many options were already proposed. Another way, less convinient is to use 
sys.stdout.buffer.write(text.encode(encoding)) (you have to flush sys.stdout 
before, and flush the buffer after, to avoid inconsistencies between the 
TextIOWrapper and the BufferedWriter).

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19846
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19933] Round default argument for ndigits

2013-12-09 Thread João Bernardo

João Bernardo added the comment:

 I don't understand.  There's already a way to make round return an integer: 
 don't pass a second argument.

If this function were to be written in Python, it would be something like:

def round(number, ndigits=0):
...

or 

def round(number, ndigits=None):
...


But in C you can forge the signature to whatever you want and parse the 
arguments accordingly. In Python there's always a way to get the default 
behavior by passing the default argument, but in C it may not exist (in this 
case `PyObject *o_ndigits = NULL;`)

So, I propose the default value being `None`, so this behavior can be achieved 
using a second argument.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19933
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19932] Missing spaces in import.h?

2013-12-09 Thread Brett Cannon

Brett Cannon added the comment:

In case no one else sees it, Ziyuan is saying that there should be a space 
after the PyAPI_FUNC() uses.

--
nosy: +brett.cannon

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19932
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19932] Missing spaces in import.h?

2013-12-09 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@gmail.com:


--
nosy: +haypo

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19932
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18983] Specify time unit for timeit CLI

2013-12-09 Thread Julian Gindi

Julian Gindi added the comment:

Implemented proposed changes to patch. Simplified for-loop and implemented 
invalid input test.

--
Added file: http://bugs.python.org/file33058/issue18983_v2.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18983
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16638] support multi-line docstring signatures in IDLE calltips

2013-12-09 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

The patch is synchronized with tip.

--
versions:  -Python 3.2
Added file: http://bugs.python.org/file33059/idle_calltips_multiline_4.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16638
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16638] support multi-line docstring signatures in IDLE calltips

2013-12-09 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


Removed file: http://bugs.python.org/file28249/idle_calltips_multiline_3.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16638
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19933] Round default argument for ndigits

2013-12-09 Thread Vajrasky Kok

Vajrasky Kok added the comment:

Here is the updated doc fix.

Anyway, why not round(1.2) - 1.0 in the first place? Just curious.

--
Added file: http://bugs.python.org/file33060/fix_doc_round_ndigits_v2.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19933
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15696] Correct __sizeof__ support for mmap

2013-12-09 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Synchronized with tip.

--
nosy: +brian.curtin, tim.golden
versions:  -Python 3.2
Added file: http://bugs.python.org/file33061/mmap_sizeof-3.x_2.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15696
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19681] test_repr (test.test_functools.TestPartialC) failures

2013-12-09 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

What is the status of this issue?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19681
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19681] test_repr (test.test_functools.TestPartialC) failures

2013-12-09 Thread Christian Heimes

Christian Heimes added the comment:

It still needs a proper fix, though.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19681
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19933] Round default argument for ndigits

2013-12-09 Thread João Bernardo

João Bernardo added the comment:

 Anyway, why not round(1.2) - 1.0 in the first place? Just curious.

It was the behavior on Python 2.x, but somehow when they changed the rounding 
method to nearest even number this happened... I think it's too late to change 
back the return type.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19933
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19933] Round default argument for ndigits

2013-12-09 Thread R. David Murray

R. David Murray added the comment:

Do you have any real-world motivating use case for None?  Not just theoretical 
consistency with what a Python version of the function would look like.  (I'm 
not saying we shouldn't consider supporting None as a low priority change, I'm 
just trying to figure out where you'd ever need it in the real world.)

--
nosy: +r.david.murray

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19933
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19915] int.bit_at(n) - Accessing a single bit in O(1)

2013-12-09 Thread Meador Inge

Changes by Meador Inge mead...@gmail.com:


--
nosy: +meador.inge

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19915
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19851] reload problem with submodule

2013-12-09 Thread Olivier Grisel

Olivier Grisel added the comment:

I tested the patch on the current HEAD and it fixes a regression introduced 
between 3.3 and 3.4b1 that prevented to build scipy from source with pip 
install scipy.

--
nosy: +Olivier.Grisel

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19851
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19933] Round default argument for ndigits

2013-12-09 Thread João Bernardo

João Bernardo added the comment:

Not really. Just consistency:

For the same reason  

' foo '.strip(None)

works... To avoid special casing the function call when you already have a 
variable to hold the argument.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19933
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15475] Correct __sizeof__ support for itertools

2013-12-09 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 9bce03920afe by Serhiy Storchaka in branch 'default':
Issue #15475: Add __sizeof__ implementations for itertools objects.
http://hg.python.org/cpython/rev/9bce03920afe

--
nosy: +python-dev

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15475
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15475] Correct __sizeof__ support for itertools

2013-12-09 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
resolution:  - fixed
stage: patch review - committed/rejected
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15475
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16055] incorrect error text for int(base=1000, x='1')

2013-12-09 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
priority: normal - low
versions: +Python 3.4 -Python 3.2

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16055
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19933] Round default argument for ndigits

2013-12-09 Thread R. David Murray

R. David Murray added the comment:

Right, but None in that case has real world utility, since you might have the 
the value in a variable.  But you are hardly going to hold int-or-not in a 
variable, especially a variable that is really about the number of places in 
the float result...

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19933
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9645] PEP 383: os.pathconf() does not accept surrogateescape arguments

2013-12-09 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

As 3.2 now in security fixes only mode, this issue has no targets.

--
resolution:  - out of date
stage: test needed - committed/rejected
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9645
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19681] test_repr (test.test_functools.TestPartialC) failures

2013-12-09 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

If you don't like permutation() (which already imported in this file), here is 
a patch which uses explicit hardcoded permutations.

--
Added file: http://bugs.python.org/file33062/issue19681_2.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19681
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19915] int.bit_at(n) - Accessing a single bit in O(1)

2013-12-09 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Should the signature be int.bits_at(start_bit, width) or int.bits_at(start_bit, 
end_bit+1) ? The latter would look more lire range() and slicing.

--
nosy: +pitrou

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19915
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19915] int.bit_at(n) - Accessing a single bit in O(1)

2013-12-09 Thread anon

anon added the comment:

Antoine, I don't suggest that since you commonly want a fixed number of bits.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19915
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19915] int.bit_at(n) - Accessing a single bit in O(1)

2013-12-09 Thread Tim Peters

Tim Peters added the comment:

@pitrou, I think usability is a lot more valuable than cross-feature formal 
consistency here.  I've been extracting bit fields for decades, and always 
think of them in terms of least-significant bit and number of bits.  Perhaps 
the underlying difference is that nobody ever thinks of bit positions as being 
_between_ bits - instead we always think of bit i as being the bit with 
binary value 2**i.  It's more of a math concept than an indexing concept.

For a bit _array_ I'd agree slicing semantics would make more sense.  But 
Python ints have infinite width, and index 0 is at the rightmost position 
(not the leftmost position - there is no leftmost position).

I'd also like to avoid the nuisance of having to implement all the goofy 
slicing possibilities, like non-unit strides and negative strides.  Not that 
they're goofy in general - they're goofy in the context of extracting bits 
from an integer.  Again a bit array is a different kind of beast.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19915
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19915] int.bit_at(n) - Accessing a single bit in O(1)

2013-12-09 Thread anon

anon added the comment:

Here is my very rough attempt at bits_at. It doesn't handle negative numbers 
and I am not sure it's safe. This was my first time using Python internals.

Objects/longobject.c:



static PyObject *
long_bits_at(PyLongObject *v, PyObject *args)
{
PyLongObject *z = NULL;

if(Py_SIZE(v)  0)
{
PyLongObject *a1, *a2;
Py_RETURN_NOTIMPLEMENTED;
a1 = (PyLongObject *)long_invert(v);
//Handle the case where a1 == NULL
a2 = (PyLongObject *)long_bits_at(a1, args);
//Handle the case where a2 == NULL
Py_DECREF(a1);
Py_DECREF(a2);
//return a2 ^ ((1  width) - 1)
}
else
{
PyObject *at_ = NULL;
PyObject *width_ = NULL;
ssize_t at, width, i, j, bitsleft, step;
ssize_t wordshift, size, newsize, loshift, hishift;
digit mask;

if (!PyArg_UnpackTuple(args, bits_at, 1, 2, at_, width_))
return NULL;

at = PyLong_AsSsize_t((PyObject *)at_);
if (at == -1L  PyErr_Occurred())
return NULL;
if (at  0) {
PyErr_SetString(PyExc_ValueError, negative index);
return NULL;
}

if (width_ == NULL)
width = 1;
else {
width = PyLong_AsSsize_t((PyObject *)width_);
if (width == -1L  PyErr_Occurred())
return NULL;
if (width  0) {
PyErr_SetString(PyExc_ValueError, negative bit count);
return NULL;
}
}

wordshift = at / PyLong_SHIFT;
size = ABS(Py_SIZE(v));
newsize = (width-1) / PyLong_SHIFT + 1;
if (newsize  size-wordshift)
newsize = size-wordshift;
if (newsize = 0)
return PyLong_FromLong(0L);

loshift = at % PyLong_SHIFT;
hishift = PyLong_SHIFT - loshift;
bitsleft = width;
z = _PyLong_New(newsize);
if (z == NULL)
return NULL;

for (i = 0, j = wordshift; i  newsize; i++, j++) {
step = bitslefthishift ? bitsleft : hishift;
mask = ((digit)1  step) - 1;
z-ob_digit[i] = (v-ob_digit[j]  loshift)  mask;
bitsleft -= step;

if (j+1  size) {
step = bitsleftloshift ? bitsleft : loshift;
mask = ((digit)1  step) - 1;
z-ob_digit[i] |= ((v-ob_digit[j+1]  mask)  hishift);
bitsleft -= step;
}
}
z = long_normalize(z);
}

return (PyObject *)z;
}

PyDoc_STRVAR(long_bits_at_doc,
int.bits_at(pos, width=1) - int\n\
\n\
Equivalent to (int  pos)  ((1  width) - 1).);

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19915
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19915] int.bit_at(n) - Accessing a single bit in O(1)

2013-12-09 Thread anon

anon added the comment:

Here are some inadequate tests to add to Lib/test/test_long.py



def test_bits_at(self):
def bits_at(n, pos, width=1):
return (npos)  ((1  width) - 1)
for n in [123, 777, (135)|(130)|(125)]:
for i in range(50):
for j in range(20):
self.assertEqual(n.bits_at(i, j), bits_at(n, i, j))

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19915
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19915] int.bit_at(n) - Accessing a single bit in O(1)

2013-12-09 Thread anon

anon added the comment:

Both segments of code are public domain. It would be great if someone could 
review them, improve them and produce a proper patch. I didn't handle the 
negative case, which I hope someone else can add.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19915
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19915] int.bit_at(n) - Accessing a single bit in O(1)

2013-12-09 Thread anon

anon added the comment:

Some of the code may be under Python's license though. So I should clarify that 
only MY parts of the two samples of code are public domain.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19915
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4945] json checks True/False by identity, not boolean value

2013-12-09 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

See also issue19795 which contains much larger patch for other modules.

--
versions:  -Python 3.2

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4945
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4945] json checks True/False by identity, not boolean value

2013-12-09 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Updated to tip.

--
nosy: +georg.brandl
Added file: http://bugs.python.org/file33063/json_doc_truefalse_2.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4945
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18983] Specify time unit for timeit CLI

2013-12-09 Thread Julian Gindi

Julian Gindi added the comment:

Incorporated updates suggested by serhiy.storchaka

--
Added file: http://bugs.python.org/file33064/issue18983_v3.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18983
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17200] telnetlib.read_until() timeout uses the wrong units

2013-12-09 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
nosy: +neologix
versions:  -Python 3.2

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17200
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17200] telnetlib.read_until() timeout uses the wrong units

2013-12-09 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

The patch is not compatible with 3.4. Does this bug exist in 3.4?

--
stage: test needed - patch review

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17200
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17200] telnetlib.read_until() timeout uses the wrong units

2013-12-09 Thread Charles-François Natali

Charles-François Natali added the comment:

 The patch is not compatible with 3.4. Does this bug exist in 3.4?

No, selectors all expect a timeout in seconds, so this should be fixed in 3.4.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17200
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18983] Specify time unit for timeit CLI

2013-12-09 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

It will be better to write error message to sys.stderr (see 
test_main_exception).

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18983
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17200] telnetlib.read_until() timeout uses the wrong units

2013-12-09 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
versions:  -Python 3.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17200
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19876] selectors (and asyncio?): document behaviour on closed files/sockets

2013-12-09 Thread Guido van Rossum

Guido van Rossum added the comment:

Sadly, the optimistic code doesn't work on Windows.  I think it may be because 
the socketpair() helper at the top of test_selectors.py uses an extra socket 
('l') and the handles just don't match up (I get a failure on assert 
wr2.fileno() == w).  So I propose to stick with the current solution of 
skipping the test on Windows.

I'll close this bug in 24 hours unless I get a response sooner.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19876
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19876] selectors (and asyncio?): document behaviour on closed files/sockets

2013-12-09 Thread STINNER Victor

STINNER Victor added the comment:

The current test using os.dup2() with a skip on Windows is fine.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19876
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19876] selectors (and asyncio?): document behaviour on closed files/sockets

2013-12-09 Thread Guido van Rossum

Guido van Rossum added the comment:

OK, closed.

--
resolution:  - fixed
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19876
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19846] Python 3 raises Unicode errors with the C locale

2013-12-09 Thread Toshio Kuratomi

Toshio Kuratomi added the comment:

Ahh... added to the nosy list and bug closed all before I got up for the day ;-)

A few words:

I do think that python is broken here.

I do not think that translating everything to utf-8 if ascii is the locale's 
encoding is the solution.

As I would state it, the problem is that python's boundary with the OS is not 
yet uniform.  If you set LC_ALL=C (note, LC_ALL=C is just one of multiple ways 
to beak things.  For instance, LC_ALL=en_US.utf8 when dealing with latin-1 data 
will also break) then python will still *read* non-ascii data from the OS 
through some interfaces but it won't output it back to the OS.  ie:

$ mkdir unicode  cd unicode
$ python3 -c 'open(ñ.txt.encode(latin-1), w).close()'
$ LC_ALL=en_US.utf8 python3
 import os
 dir_listing = os.listdir('.')
 for entry in dir_listing: print(entry)
... 
Traceback (most recent call last):
  File stdin, line 1, in module
UnicodeEncodeError: 'utf-8' codec can't encode character '\udcf1' in position 
0: surrogates not allowed

Note that currently, input() and sys.stdin.read() won't read undecodable data 
so this is somewhat symmetrical but it seems to me that saying everything that 
interfaces with the OS except the standard streams will use surrogateescape on 
undecodable bytes is drawing a line in an unintuitive location.

(A further note to serhiy.storchaka Your examples are not showing anything 
broken in other programs.  xterm is refusing both input and output that is 
non-ascii.  This is symmetric behaviour.  ls is doing its best to display a 
*human-readable* representation of bytes that it cannot convert in the current 
encoding.  It also provides the -b switch to see the octal values if you 
actually care.  Think of this like opening a binary file in less or another 
pager.)

(Further note for haypo -- On Fedora, the default of en_US is utf8, not 
ISO8859-1.)

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19846
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18616] enable more ssl socket options with get_server_certificate

2013-12-09 Thread Derek Wilson

Derek Wilson added the comment:

any thoughts on this? there's a lot of room for improvement in python ssl...

--
versions: +Python 3.5

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18616
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19933] Round default argument for ndigits

2013-12-09 Thread Mark Dickinson

Mark Dickinson added the comment:

 Anyway, why not round(1.2) - 1.0 in the first place? Just curious.

All this changed as part of PEP 3141.  I wasn't watching Python 3 development 
closely back then, but I *think* at least part of the motivation was to provide 
a way to get away from the use of `int` to truncate a float to its integer 
part:  the argument goes that a simple type conversion shouldn't throw away 
information, and that if you want a transformation from float to int that 
throws away information you should ask for it explicitly.  So `math.trunc` was 
born as the preferred way to truncate a float to an int, and `math.floor`, 
`math.ceil` and `round` became alternative float - int conversion methods.  
That entailed those functions returning ints.

off-topic In the case of `math.floor` and `math.ceil` at least, I think this 
is regrettable.  There are plenty of places where you just want a float - 
float floor or ceiling, and Python no longer has a cheap operation for that 
available:  floor as a float-to-float operation is cheap;  floor as a 
float-to-long-integer operation is significantly more costly.

In the case of `round`, we still have `round(x, 0)` available as a cheap 
float-float conversion, so it's less of a problem.  And I hardly ever use 
`trunc`, so I don't care about that case. /off-topic

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19933
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17200] telnetlib.read_until() timeout uses the wrong units

2013-12-09 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Last patch is corrupted and outdated. Here is updated and fixed version. I have 
not examined it closely.

--
Added file: http://bugs.python.org/file33065/issue17200.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17200
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18010] pydoc search chokes on import errors

2013-12-09 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
nosy:  -serhiy.storchaka

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18010
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19481] IDLE hangs while printing instance of Unicode subclass

2013-12-09 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

 Pickling for the RPC protocol between the GUI process and the interpreter 
 subprocess, which would explain why there is no problem when running idle -n 
 (no subproces)?

Yes, it is.

If there are no objections I'll commit these patches.

--
assignee:  - serhiy.storchaka

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19481
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18983] Specify time unit for timeit CLI

2013-12-09 Thread Julian Gindi

Julian Gindi added the comment:

Updated patch to log to stderr.

--
Added file: http://bugs.python.org/file33066/issue18983_v4.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18983
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17576] PyNumber_Index() is not int-subclass friendly (or operator.index() docos lie)

2013-12-09 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Ping.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17576
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18233] SSLSocket.getpeercertchain()

2013-12-09 Thread Derek Wilson

Derek Wilson added the comment:

I could really use this sooner than later... and sometimes having a 
full-featured (or even secure) interface is not what you want.

Consider zmap and masscan etc and ssl mapping (similar to what the EFF did a 
couple years back - https://www.eff.org/observatory - but with the full chain 
instead of just the cert). The desire here would be low level, low overhead, no 
validation on the fly: All you want is the cert chain.

There are plenty of research and security applications where a simple wrapper 
around OpenSSL that returns DER bytes would be desirable. Please reconsider 
this patch for inclusion in 3.4 ...

--
versions: +Python 3.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18233
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17576] PyNumber_Index() is not int-subclass friendly (or operator.index() docos lie)

2013-12-09 Thread Mark Dickinson

Mark Dickinson added the comment:

 Ping.

Bah.  Sorry; I haven't had time to deal with this.  Serhiy: are you interested 
in taking over?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17576
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18983] Specify time unit for timeit CLI

2013-12-09 Thread Julian Gindi

Julian Gindi added the comment:

Added newline after error message.

--
Added file: http://bugs.python.org/file33067/issue18983_v5.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18983
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18983] Specify time unit for timeit CLI

2013-12-09 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

The patch is doubled.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18983
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18983] Specify time unit for timeit CLI

2013-12-09 Thread Julian Gindi

Julian Gindi added the comment:

Whoops. Sorry about that. Super embarrassing.

--
Added file: http://bugs.python.org/file33068/issue18983_v5.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18983
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19937] IDLE can't be launched

2013-12-09 Thread Ned Deily

Ned Deily added the comment:

This is a duplicate of 18270.  As explained there, the workaround is to follow 
the instructions at http://www.python.org/download/mac/tcltk/ and, if possible, 
install an up-to-date Tcl/Tk 8.5 from ActiveState.  If that is not possible, 
then launch IDLE from the command line with an initial shell window:

/usr/local/bin/python3.3 -m idlelib -i

and be sure to change the preference to always launch with a shell window.

--
nosy: +ned.deily
resolution:  - duplicate
stage:  - committed/rejected
status: open - closed
superseder:  - IDLE on OS X fails with Attribute Error if no initial shell and 
Tk out-of-date
title: IDLE can't be launch - IDLE can't be launched
type: compile error - 

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19937
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19481] IDLE hangs while printing instance of Unicode subclass

2013-12-09 Thread Terry J. Reedy

Terry J. Reedy added the comment:

 [2.7] print() implicitly converts str and bytearray subclasses to str and 
 left unicode subclasses as is.

This strikes me as possibly a bug in print, but even if that were changed, 
there is still the issue of sys.stdout.write and pickle. While the patch is a 
great improvement, it changes the behavior of sys.stdout.write(s), which acts 
like it calls str.__str__(s) rather than str(s) == s.__str__

---
class S(str):
def __str__(self):
return 'S: ' + str.__str__(self)

s = S('foo')
print(s, str(s), str.__str__(s))

import sys
sys.stdout.write(s)
---
S: foo S: foo foo
foo

on the console (hang after first line on Idle)

I am testing the patch with str(s) changed to str.__str__(s).

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19481
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19481] IDLE hangs while printing instance of Unicode subclass

2013-12-09 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Confirmed that the revised patch for 3.3 fixes the hang and matches the console 
interpreter output.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19481
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19915] int.bit_at(n) - Accessing a single bit in O(1)

2013-12-09 Thread Tim Peters

Tim Peters added the comment:

@anon, sorry, but we can't accept any code from you unless you have a real name 
and fill out a contributor agreement:

   http://www.python.org/psf/contrib/

This is legal crud, and I'm not a lawyer.  But, in particular, lawyers have 
told me that - in the USA - an individual cannot meaningfully put anything in 
the public domain.  That's what I used to do - until a lawyer strongly 
advised me to stop that and use an actual license.

In any case, it's most likely that Python developers won't even look at your 
code in the absence of a contributor agreement.  If we did, the slight chance 
of Bad Consequences (e.g., someone we only knew as anon sues us for stealing 
their ideas) outweighs the slight benefit we might get from stealing your ideas 
;-)

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19915
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19915] int.bit_at(n) - Accessing a single bit in O(1)

2013-12-09 Thread HCT

HCT added the comment:

 I think slicing semantically seems wrong but it might be more elegant. It 
 might also make catching errors harder (in the case where an int is sent to a 
 function that does slicing and now won't fail with a TypeError).

not sure what's semantically seems wrong with it. not sure why TypeError or 
any other error catching should come into play for this.

calling a function is way more expensive than doing bit shift and/or AND 
operation. as a function, you've only hide your code into Python binaries at 
the expense of performance

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19915
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



  1   2   >