[issue27867] various issues due to misuse of PySlice_GetIndicesEx

2016-08-27 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I'm saying that PySlice_GetIndicesEx2 can't just use Py_SIZE.

--

___
Python tracker 

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



[issue27861] sqlite3 type confusion and multiple frees

2016-08-27 Thread Xiang Zhang

Xiang Zhang added the comment:

Thanks for the comments Serhiy. v3 now fixs all that.

--
Added file: https://bugs.python.org/file44245/issue27861_conn_cursor_v3.patch

___
Python tracker 

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



[issue27867] various issues due to misuse of PySlice_GetIndicesEx

2016-08-27 Thread Terry J. Reedy

Terry J. Reedy added the comment:

FWIW. Py_SIZE is used all over listobject.c.  Are you saying that this could be 
improved?

--

___
Python tracker 

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



[issue27867] various issues due to misuse of PySlice_GetIndicesEx

2016-08-27 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

This is a toy example that exposes the problem, but the problem itself is not a 
toy problem. The key point is that calculating slice indices cause executing 
Python code and releases GIL. In multithread program a sequence can be changed 
not in toy __index__ method, but in other thread, in legitimate code. This is 
very hardly reproducible bug.

Variants B are not efficient. To determine the size of a sequence we should 
call its __len__() method. This is less efficient than using macros Py_SIZE() 
or PyUnicode_GET_LENGTH(). And it is not always possible to pass a sequence. In 
multidimensional array there is no such sequence (see for example 
_testbuffer.ndarray).

--

___
Python tracker 

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



[issue27882] Python docs on 9.2 Math module lists math.log2 as function but it does not exist

2016-08-27 Thread Emanuel Barry

New submission from Emanuel Barry:

The function does definitely exist for me. Please make sure your Python version 
is up-to-date. Also, please post a short summary of the issue, and avoid 
screenshots whenever possible; it's more work for you, makes it harder for us 
to reproduce/follow (need to manually type everything back), and makes it 
impossible for the blind and visually impaired to participate. Thanks!

--
assignee: docs@python -> 
components:  -Documentation
nosy: +ebarry
status: open -> pending

___
Python tracker 

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



[issue27761] Private _nth_root function loses accuracy

2016-08-27 Thread Tim Peters

Tim Peters added the comment:

Adding one more version of the last code, faster by cutting the number of extra 
digits used, and by playing "the usual" low-level CPython speed tricks.

I don't claim it's always correctly rounded - although I haven't found a 
specific case where it isn't.  I do claim it will return the exact result 
whenever the exact result is representable as a float.

I also claim it's "fast enough" - this version does on the high end of 50 to 
100 thousand roots per second on my box, pretty much independent of `n`.

import decimal
c = decimal.DefaultContext.copy()
c.prec = 25
def rootn(x, n,
  D=decimal.Decimal,
  pow=c.power,
  mul=c.multiply,
  add=c.add,
  div=c.divide):
g = D(x**(1.0/n))
n1 = D(n-1)
g = div(add(mul(n1, g),
div(D(x), pow(g, n1))),
n)
return float(g)
del decimal, c

--

___
Python tracker 

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



[issue27882] Python docs on 9.2 Math module lists math.log2 as function but it does not exist

2016-08-27 Thread Richard

Changes by Richard :


Added file: https://bugs.python.org/file44244/docbugmathlog2.jpg

___
Python tracker 

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



[issue27882] Python docs on 9.2 Math module lists math.log2 as function but it does not exist

2016-08-27 Thread Richard

Changes by Richard :


--
title: Python docs on 9.52 Math module lists math.log2 as function but it does 
not exist -> Python docs on 9.2 Math module lists math.log2 as function but it 
does not exist

___
Python tracker 

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



[issue27882] Python docs on 9.52 Math module lists math.log2 as function but it does not exist

2016-08-27 Thread Richard

Changes by Richard :


--
title: Python docs on 3.52 Math module lists math.log2 as function but it does 
not exist -> Python docs on 9.52 Math module lists math.log2 as function but it 
does not exist

___
Python tracker 

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



[issue27882] Python docs on 3.52 Math module lists math.log2 as function but it does not exist

2016-08-27 Thread Richard

Changes by Richard :


--
assignee: docs@python
components: Documentation
nosy: PyRW, docs@python
priority: normal
severity: normal
status: open
title: Python docs on 3.52 Math module lists math.log2 as function but it does 
not exist
versions: Python 3.5

___
Python tracker 

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



[issue27413] Add an option to json.tool to bypass non-ASCII characters.

2016-08-27 Thread Wei-Cheng Pan

Changes by Wei-Cheng Pan :


Removed file: 
https://bugs.python.org/file43596/json-add-an-option-to-bypass-non-ascii-characters.patch

___
Python tracker 

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



[issue27413] Add an option to json.tool to bypass non-ASCII characters.

2016-08-27 Thread Wei-Cheng Pan

Wei-Cheng Pan added the comment:

Added doc and test.

--
Added file: 
https://bugs.python.org/file44243/json-add-an-option-to-bypass-non-ascii-characters-v3.patch

___
Python tracker 

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



[issue26081] Implement asyncio Future in C to improve performance

2016-08-27 Thread INADA Naoki

INADA Naoki added the comment:

There are only two weeks until 3.6 beta.
Yury, could you review this again?

Or should I implement freelist before review?
Implementing freelist may be easy, but measuring the effect of freelist from
realistic application is not easy.

--

___
Python tracker 

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



[issue14376] sys.exit documents argument as "integer" but actually requires "subtype of int"

2016-08-27 Thread Lucas Hoffmann

Changes by Lucas Hoffmann :


--
nosy: +luc

___
Python tracker 

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



[issue27867] various issues due to misuse of PySlice_GetIndicesEx

2016-08-27 Thread Terry J. Reedy

Terry J. Reedy added the comment:

There is really one immediate issue: PySlice_GetIndicesEx in 
Objects/sliceobject.c takes as inputs a slice object and a sequence length, but 
not the sequence itself.  It starts with "/* this is harder to get right than 
you might think */"  Yep.  It assumes both inputs are constants.

However, it thrice calls _PyEval_SliceIndex(intlike) (Python/ceval.c). This 
call in turn may call PyNunber_AsSsize_t(intlike), which calls 
intlike.__index__.  At least in toy examples, this last can change an 
underlying mutable sequence and hence its length.  Since the calculation of the 
returned start, stop, step, and slicelength depend on the length, the result is 
that PySlice_GetIndeces can indirectly invalidate its own results.
---

Side effects in __index__ also affect indexing

class X:
def __index__(self):
b[:] = []
return 1

b = [1,2,3,4]
b[X()]

Traceback (most recent call last):
  File "F:\Python\mypy\tem.py", line 7, in 
print(b[X()])
IndexError: list index out of range

Similarly, "b[X()] = 4" results in "list assignment index ...".

Crashes seem not possible as the conversion to a real int seems to always be 
done locally in the sequence_subscript method.  See for instance list_subscript 
and list_ass_subscript in Objects/listojbect.c.  If the subscript is an index, 
it is *first* converted to int with PyNumber_AsSsize_t *before* being possibly 
incremented by PySize(self) and compared to the same.

Side-effects also affect index methods.

class X:
def __index__(self):
b[:] = []
return 1

b = [1]
b.index(1, X())

Traceback (most recent call last):
  File "F:\Python\mypy\tem.py", line 7, in 
print(b.index(1, X()))
ValueError: 1 is not in list

For tuple/list/deque.index(val, start, stop), start and stop are converted to 
int with _PyEval_SliceIndex, as with slices.  However, they make this call as 
part of an initial PyArg_ParseTuple call, before adjusting them to the length 
of the sequence.  So again, no crash is possible.

I suppose there are other places where PyNumber_AsSsize_t is called, and where 
a crash *might* be possible, and should be checked,  But back to slicing.
---

Action on this issue requires a policy decision among three options.

0.  In general, special methods should be proper functions, without side 
effects, that return what the doc suggests.  Doing otherwise is 'at one own 
risk'.  Close that as "won't fix" because anyone writing an 'intlike' with such 
an evil __index__ method deserves the result, even it it is a crash.  Also, 
this seems like a toy problem since it require __index__ can know of and access 
the collection it is being called for.  It would otherwise only be written my a 
malicious attacker, who could do things much worse in the __index__ methods.

Counter arguments: A. Our usual policy is that pure Python code only using the 
stdlib (minus ctypes) should not crash.  B. The writer and user of 'intlike' 
might be different people.

Question: does 'no crash' apply to arbitrary side-effects in special methods?

1. Declare and enforce that a length-changing side-effect in __index__ used 
with slicing is a bug and raise ValueError.  A. Change every 
mutable_collection(_ass)_subscript method to record is length before calling 
PySlice_GetIndicesEx and check itself afterwards. B. Create 
PySlice_GetIndicesEx2 to receive *collection instead of length, so *it* can do 
the before and check in just one place, and change the calls.

2. As I suggested earlier: 'slicing should always work'.  Ensure that the 
'length' used to adjust int slice components is the correct value, after all 
calls to __index__.  A. Change all calling sites, as above, to pass a slice 
object with int components and a length calculated after int conversions.  Bl. 
Create PySlice_GetIndicesEx2 to receive *collection, so *it* can retrieve the 
length after __index__ conversions.

I will ask on pydev which, if any, of the 4 possible patches would be best.

--

___
Python tracker 

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



[issue26027] Support Path objects in the posix module

2016-08-27 Thread Brett Cannon

Brett Cannon added the comment:

Thanks for fixing it, Berker!

On Sat, Aug 27, 2016, 12:59 Berker Peksag  wrote:

>
> Berker Peksag added the comment:
>
> Builtbots look happy now:
>
> * Windows 7 SP1:
> http://buildbot.python.org/all/builders/AMD64%20Windows7%20SP1%203.x/builds/8177
> * Windows 8:
> http://buildbot.python.org/all/builders/AMD64%20Windows8%203.x/builds/2476
> * Windows 10:
> http://buildbot.python.org/all/builders/AMD64%20Windows10%203.x/builds/1377
>
> --
> status: open -> closed
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue26027] Support Path objects in the posix module

2016-08-27 Thread Berker Peksag

Berker Peksag added the comment:

Builtbots look happy now:

* Windows 7 SP1: 
http://buildbot.python.org/all/builders/AMD64%20Windows7%20SP1%203.x/builds/8177
* Windows 8: 
http://buildbot.python.org/all/builders/AMD64%20Windows8%203.x/builds/2476
* Windows 10: 
http://buildbot.python.org/all/builders/AMD64%20Windows10%203.x/builds/1377

--
status: open -> closed

___
Python tracker 

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



[issue27740] Fix doc of Py_CompileStringExFlags

2016-08-27 Thread Xiang Zhang

Xiang Zhang added the comment:

I am not a native speaker so I decide not to trap in the minor part. Could you 
just fix the first point if there is no doubt? I'm okay with the second part 
staying as now.

--
Added file: https://bugs.python.org/file44242/issue27740.patch

___
Python tracker 

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



[issue27414] http.server.BaseHTTPRequestHandler inconsistence with Content-Length value

2016-08-27 Thread Xiang Zhang

Xiang Zhang added the comment:

Delete by other test cases without restoring? Which is rather impossible to 
happen. But I'd like it to stay like now. It is not complex and straight when 
reading. I don't want to change it to swap_attr.

--

___
Python tracker 

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



[issue27881] Fix possible bugs when setting sqlite3.Connection.isolation_level

2016-08-27 Thread Xiang Zhang

New submission from Xiang Zhang:

This is a follow up of issue27861 and means to fix the second issue mentioned 
in it.

pysqlite_connection_set_isolation_level now does not check allowed values and 
when any part fails, it leaves the Connection object in an inconsistent state.

I'll write a patch trying to fix this tomorrow.

--
components: Library (Lib)
messages: 273796
nosy: berker.peksag, serhiy.storchaka, tehybel, xiang.zhang
priority: normal
severity: normal
status: open
title: Fix possible bugs when setting sqlite3.Connection.isolation_level
type: behavior
versions: Python 3.5, Python 3.6

___
Python tracker 

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



[issue27880] cPickle fails on large objects (still - 2011 and counting)

2016-08-27 Thread Robert Pierce

New submission from Robert Pierce:

cPickle fails on large objects, throwing a SystemError exception which is 
cryptic. 

The issue was fixed for pickle in python 3 back in 2011 
(http://bugs.python.org/issue11564), but never addressed in 2.7.  It seems to 
be a recurring complaint (e.g., http://bugs.python.org/issue11872), but always 
seems to be closed without being fixed or explained why it cannot be fixed.

Test case from 2011 still fails:

>>> import cPickle; cPickle.dumps('a' * (2 ** 31),-1)
Traceback (most recent call last):
  File "", line 1, in 
SystemError: error return without exception set

--
components: Library (Lib)
messages: 273795
nosy: rob...@smithpierce.net
priority: normal
severity: normal
status: open
title: cPickle fails on large objects (still - 2011 and counting)
type: behavior
versions: Python 2.7

___
Python tracker 

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



[issue27861] sqlite3 type confusion and multiple frees

2016-08-27 Thread Xiang Zhang

Xiang Zhang added the comment:

If decide to follow the behaviour of code rather than doc, it's a different 
story. issue27861_conn_cursor_v2.patch tries to solve the first issue. It now 
preserve the previous behaviour treating factory as a callable not a cursor 
type.

--
Added file: https://bugs.python.org/file44241/issue27861_conn_cursor_v2.patch

___
Python tracker 

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



[issue26027] Support Path objects in the posix module

2016-08-27 Thread Eryk Sun

Eryk Sun added the comment:

I wish the name was "pushCleanup" to emphasize that cleanup functions are 
popped and called in LIFO order.

--
nosy: +eryksun

___
Python tracker 

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



[issue26027] Support Path objects in the posix module

2016-08-27 Thread Berker Peksag

Berker Peksag added the comment:

test_path_t_converter failure looks similar to 
http://bugs.python.org/issue27493#msg271047 (fixed by 5424252ce174.) I've 
tested a fix on my Windows box and the test passed for me. Hopefully 
8ec5a00e5d75 will fix the problem on buildbots too :)

--
nosy: +berker.peksag

___
Python tracker 

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



[issue26027] Support Path objects in the posix module

2016-08-27 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 8ec5a00e5d75 by Berker Peksag in branch 'default':
Issue #26027: Fix test_path_t_converter on Windows
https://hg.python.org/cpython/rev/8ec5a00e5d75

--

___
Python tracker 

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



[issue27879] add os.syncfs()

2016-08-27 Thread Марк Коренберг

New submission from Марк Коренберг:

I mean http://linux.die.net/man/2/syncfs

--
components: Library (Lib)
messages: 273790
nosy: mmarkk
priority: normal
severity: normal
status: open
title: add os.syncfs()
type: enhancement
versions: Python 3.6

___
Python tracker 

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



[issue27861] sqlite3 type confusion and multiple frees

2016-08-27 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

About the first bug. Checking that a factory is a subclass of sqlite3.Cursor is 
not enough. I suppose that a subclass of sqlite3.Cursor with overridden __new__ 
could pass the check but cause a crash.

class BadCursor(sqlite3.Cursor):
def __new__(cls, conn):
return None

Docs should be changed as well as the code.

As for the second bug, please open a separate issue. This is more complex issue.

--

___
Python tracker 

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



[issue26027] Support Path objects in the posix module

2016-08-27 Thread Brett Cannon

Brett Cannon added the comment:

It's still failing: 
http://buildbot.python.org/all/builders/AMD64%20Windows7%20SP1%203.x/builds/8176/steps/test/logs/stdio
 .

Don't have time to look at why right now and I'm on a Mac ATM so I can't test 
locally to try and fix it until I'm at work on Monday. If someone has an idea 
as to why this is only happening on Windows I'm open to understanding.

--
components: +Windows
nosy: +paul.moore, steve.dower, tim.golden, zach.ware
status: closed -> open

___
Python tracker 

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



[issue27861] sqlite3 type confusion and multiple frees

2016-08-27 Thread Xiang Zhang

Xiang Zhang added the comment:

Thanks for the comments, Serhiy and palaviv. I left some questions in reply to 
them.

--

___
Python tracker 

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



[issue12178] csv writer doesn't escape escapechar

2016-08-27 Thread Berker Peksag

Changes by Berker Peksag :


--
nosy: +berker.peksag
versions: +Python 3.5, Python 3.6 -Python 3.2, Python 3.3

___
Python tracker 

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



[issue26027] Support Path objects in the posix module

2016-08-27 Thread Brett Cannon

Brett Cannon added the comment:

Hopefully https://hg.python.org/cpython/rev/775158408ecb will fix the problem.

--
status: open -> closed

___
Python tracker 

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



[issue27506] make bytes/bytearray translate's delete a keyword argument

2016-08-27 Thread Xiang Zhang

Xiang Zhang added the comment:

Yay, thanks for your work, Martin.

--

___
Python tracker 

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



[issue12178] csv writer doesn't escape escapechar

2016-08-27 Thread Skip Montanaro

Skip Montanaro added the comment:

The patch looked okay to me, and when applied to the 2.7 source, the new tests 
pass muster.

I'm not going to pretend I know where this patch should be applied. That's for 
someone else to pronounce.

--

___
Python tracker 

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



[issue12178] csv writer doesn't escape escapechar

2016-08-27 Thread Skip Montanaro

Changes by Skip Montanaro :


--
nosy:  -skip.montanaro

___
Python tracker 

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



[issue27875] Syslogs /usr/sbin/foo as /foo instead of as foo

2016-08-27 Thread SilentGhost

Changes by SilentGhost :


--
components: +Extension Modules
nosy: +jafo
stage:  -> needs patch
versions: +Python 3.5, Python 3.6

___
Python tracker 

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



[issue27878] Unicode word boundries

2016-08-27 Thread SilentGhost

SilentGhost added the comment:

regex module is not in standard library, on the latest 3.6 branch re module 
breaks on curly apostrophe just fine. Perhaps, try reporting this issue on the 
bitbucket tracker?

--
nosy: +SilentGhost
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed
versions:  -Python 2.7, Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 
3.6

___
Python tracker 

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



[issue25847] CPython not using Visual Studio code analysis!

2016-08-27 Thread Mark Lawrence

Changes by Mark Lawrence :


--
nosy:  -BreamoreBoy

___
Python tracker 

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



[issue27878] Unicode word boundries

2016-08-27 Thread mohammad aghanabi

New submission from mohammad aghanabi:

According to [UAX #29](http://unicode.org/reports/tr29) - unicode word 
boundaries (rule WB5a), an apostrophe includes U+0027 ( ' ) APOSTROPHE and 
U+2019 ( ’ ) RIGHT SINGLE QUOTATION MARK (curly apostrophe).

However regex module only implements U+0027 and the second kind (U+2019) is 
missing:

/* Break between apostrophe and vowels (French, Italian). */
/* WB5a */
if (pos_m1 >= 0 && char_at(state->text, pos_m1) == '\'' &&
is_unicode_vowel(char_at(state->text, text_pos)))
return TRUE;


[Source 
code](https://bitbucket.org/mrabarnett/mrab-regex/src/f21447bf288780d8dd9b1633820480484ce8f677/regex_3/regex/_regex.c?at=default&fileviewer=file-view-default#_regex.c-1657)

--
components: Regular Expressions
messages: 273782
nosy: ezio.melotti, mohammad aghanabi, mrabarnett
priority: normal
severity: normal
status: open
title: Unicode word boundries
type: behavior
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 3.6

___
Python tracker 

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



[issue27425] Tests fail because of git's newline preferences on Windows

2016-08-27 Thread Emanuel Barry

Emanuel Barry added the comment:

Martin: Indeed, seems like it's backwards for some reason. I'm not sure what 
happened when I regenerated the index; I removed the patches now anyway. I 
think the .gitattributes patch would be fine to go on its own.

It's my understanding that line endings don't matter for XML files, so it would 
probably be a better move to fix xml.sax instead of the test. I'll likely open 
a new issue if we decide to do that.

--

___
Python tracker 

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



[issue27425] Tests fail because of git's newline preferences on Windows

2016-08-27 Thread Emanuel Barry

Changes by Emanuel Barry :


Removed file: https://bugs.python.org/file44220/fix_newlines_1.patch

___
Python tracker 

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



[issue27425] Tests fail because of git's newline preferences on Windows

2016-08-27 Thread Emanuel Barry

Changes by Emanuel Barry :


Removed file: https://bugs.python.org/file44225/fix_newlines_2.patch

___
Python tracker 

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



[issue27877] Add recipe for "valueless" Enums to docs

2016-08-27 Thread John Hagen

New submission from John Hagen:

Many programming languages allow the developer to define a enum without 
specifying values when there would be no significance to those values.  Adding 
some kind of support in the stdlib itself was rejected due to the high degree 
of magic that would be needed: https://bugs.python.org/issue26988

I propose that a simple example be added to the enum docs that show a developer 
how to use a normal Python Enum to create this most common and basic enum 
(without values).

import enum

class Color(enum.Enum):
red = object()
green = object()
blue = object()

object() returns a new unique value while conveying that that value should not 
be expected to be used in any meaningful way (unlike an integer value, which 
could be used to encode the Enum in some way).

There is no extra magic going on here, no new code that needs to be added to 
the stdlib, and no bare identifiers that could confuse linters.  For example, 
PyCharm already fully understands the above example and statically types it.

This example also allows the developer to omit the extra @enum.unique() 
boilerplate that is normally needed, since he or she cannot accidentally use 
the same integer value twice.

--
assignee: docs@python
components: Documentation
messages: 273780
nosy: John Hagen, barry, docs@python, eli.bendersky, ethan.furman
priority: normal
severity: normal
status: open
title: Add recipe for "valueless" Enums to docs
type: enhancement
versions: Python 3.6

___
Python tracker 

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



[issue27874] inconsistent sys.path behavior when using PythonXX.zip

2016-08-27 Thread Joseph Shen

Joseph Shen added the comment:

thanks for the comment and make python work on Windows better :)
I will trace the 3.6 source code.

On Sat, Aug 27, 2016 at 8:58 PM Steve Dower  wrote:

>
> Steve Dower added the comment:
>
> I don't entirely agree with the analysis or suggestions here, but I do
> intend to change this for 3.6 so I'll assign myself. At the very least, we
> won't fall back on totally relative paths - we'll make them absolute from
> the program directory.
>
> --
> assignee:  -> steve.dower
> resolution: not a bug ->
> stage: resolved -> needs patch
> versions: +Python 3.6 -Python 3.5
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue27078] Make f'' strings faster than .format: BUILD_STRING opcode?

2016-08-27 Thread Demur Rumed

Demur Rumed added the comment:

I don't think lack of precedence is a reason to say new opcodes are new 
features. More that generally new opcodes are created for new features

--

___
Python tracker 

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



[issue27874] inconsistent sys.path behavior when using PythonXX.zip

2016-08-27 Thread Steve Dower

Steve Dower added the comment:

I don't entirely agree with the analysis or suggestions here, but I do intend 
to change this for 3.6 so I'll assign myself. At the very least, we won't fall 
back on totally relative paths - we'll make them absolute from the program 
directory.

--
assignee:  -> steve.dower
resolution: not a bug -> 
stage: resolved -> needs patch
versions: +Python 3.6 -Python 3.5

___
Python tracker 

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



[issue27078] Make f'' strings faster than .format: BUILD_STRING opcode?

2016-08-27 Thread Antti Haapala

Antti Haapala added the comment:

So does this (new opcode) count as a new feature? It would be great to give f'' 
strings a flying start, saying that not only they're cool, they're also faster 
than anything that you've used before.

Here some more mini-benchmarks with serhiy's patch2 applied, the times are 
pretty stable:

% python3.6 -mtimeit -s 'x = 42' '"%s-" % x'
1000 loops, best of 3: 0.184 usec per loop

% python3.6 -mtimeit -s 'x = 42' 'f"{x}-"' 
1000 loops, best of 3: 0.142 usec per loop

and

% python3.6 -mtimeit -s 'x = "42"' 'f"{x}{x}"'
1000 loops, best of 3: 0.0709 usec per loop

% python3.6 -mtimeit -s 'x = "42"' '"%s%s" % (x,x)'
100 loops, best of 3: 0.213 usec per loop

python3.6 -mtimeit -s 'x = "42"' '"".join((x, x))'
1000 loops, best of 3: 0.155 usec per loop

This is only really achievable with some kind of bytecode support.

--

___
Python tracker 

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



[issue27858] Add identity function to functools

2016-08-27 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
resolution: rejected -> duplicate
stage:  -> resolved
superseder:  -> add identity function

___
Python tracker 

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



[issue27867] various issues due to misuse of PySlice_GetIndicesEx

2016-08-27 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Even list suffers from this bug if slicing step is not 1.

class X:
def __index__(self):
del a[:]
return 1

a = [0]
a[:X():2]

--

___
Python tracker 

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



[issue27874] inconsistent sys.path behavior when using PythonXX.zip

2016-08-27 Thread Joseph Shen

Joseph Shen added the comment:

I don't know how to reopen this issue, please make some comments for 
what I added just now, thanks.

--
status: closed -> open

___
Python tracker 

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



[issue27863] multiple issues in _elementtree module

2016-08-27 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
dependencies: +various issues due to misuse of PySlice_GetIndicesEx

___
Python tracker 

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



[issue27874] inconsistent sys.path behavior when using PythonXX.zip

2016-08-27 Thread Joseph Shen

Joseph Shen added the comment:

Yea, thanks for review, I knew the pyven. But the behavior right now is
really what I think unnecessary complicated and confusing.
What I think, we all knew the DLLs is used for python keep the *.pyd
(actually just dll), so by default, why we want this directory
relative to the working directory? indeed the configure file can fix this,
but is this process really what we needed? we need check
the PYTHONHOME , read the registy, check if the configure file exist, just
for make python find the libraries?  I knew python has
a long history for keep the library path environment variable work right,
and not even mention pyenv and some other tools, but this
just make things more complicated.

So, as a conclusion, I think we should make the sys.path consistent with or
without using zip packed library, especially for the DLLs
if we think about some backward compatibility.fix this is just a small step
for making python application launch faster and packing simpler.

Thanks, I think this problem still arguable.

On Sat, Aug 27, 2016 at 17:38 Eryk Sun  wrote:

>
> Eryk Sun added the comment:
>
> Windows Python determines sys.prefix (i.e. the location of the standard
> library, \lib) via either the PYTHONHOME environment variable or by
> searching for the landmark "lib/os.py", starting in the application
> directory and reducing back to the root directory [1].
>
> If it can't find the prefix directory; PYTHONPATH isn't defined; and it
> can't find PythonPath in the registry; then it adds the "DLLs" and "lib"
> directories relative to the working directory. This default PYTHONPATH is
> defined in PC/pyconfig.h as ".\\DLLs;.\\lib".
>
> There is an alternative "applocal" (application local) mode. Create a file
> named pyvenv.cfg beside python.exe that contains the single line
>
> applocal = true
>
> This prevents Python from checking PYTHONHOME and PYTHONPATH, the
> registry, and prevents searching for the "lib/os.py" landmark. sys.prefix
> is set as the application directory, and the default "DLLs" and "lib" paths
> are expanded relative to the application directory.
>
> Anyway, since what you're reporting is the expected behavior, I'm closing
> this issue. Feel free to reopen it if you feel I've misdiagnosed the
> problem or think the default behavior is somehow broken. I don't know what
> Steve Dower's plans are, if indeed he has any, to change the legacy
> sys.path behavior in future releases.
>
>
> [1]: The reduce() function in PC/getpathp.c has a minor bug that
>  results in sys.prefix set as the drive-relative path "C:" if
>  the landmark search continues to the root and "C:/lib/os.py"
>  exists. This is due to the way it overwrites the path separator
>  with NUL to reduce the path. I think it should keep the
>  separator. The join() function works either way.
>
> --
> nosy: +eryksun
> resolution:  -> not a bug
> stage:  -> resolved
> status: open -> closed
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue27876] Add SSLContext.set_version_range(minver, maxver=None)

2016-08-27 Thread Christian Heimes

New submission from Christian Heimes:

OpenSSL 1.1 has deprecated all version specific TLS/SSL methods in favor of 
auto-negotiation (formerly known as SSLv23). It also introduced two macros to 
set the minimal and maximum TLS version with SSL_CTX_set_min_proto_version() 
and SSL_CTX_set_max_proto_version(). The macros can be emulated for OpenSSL < 
1.1 with reasonable effort.

I suggest that ssl.SSLContext introduces set_version_range(minver, maxver=None) 
method. It's less awkward to use than fiddling with modes and OP_NO_SSLv3.

--
components: Extension Modules
messages: 273772
nosy: alex, christian.heimes, dstufft, giampaolo.rodola, janssen
priority: normal
severity: normal
status: open
title: Add SSLContext.set_version_range(minver, maxver=None)
type: enhancement
versions: Python 3.6

___
Python tracker 

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



[issue27861] sqlite3 type confusion and multiple frees

2016-08-27 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Agreed, there are two unrelated bugs. It would be better to discuss separate 
patches in separate issues.

--

___
Python tracker 

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



[issue27506] make bytes/bytearray translate's delete a keyword argument

2016-08-27 Thread Martin Panter

Changes by Martin Panter :


--
resolution:  -> fixed
stage: commit review -> resolved
status: open -> closed

___
Python tracker 

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



[issue27875] Syslogs /usr/sbin/foo as /foo instead of as foo

2016-08-27 Thread Fabian Pietsch

New submission from Fabian Pietsch:

When calling syslog.syslog() without calling syslog.openlog() before, openlog() 
gets called with no arguments. Documentation says: "The optional ident keyword 
argument is a string which is prepended to every message, and defaults to 
sys.argv[0] with leading
path components stripped." -- "35.13. syslog — Unix syslog library routines"

It leaves the final slash in, though. This produces syslog output for 
/usr/sbin/foo with identifier "/foo" instead of "foo". When reading syslog 
unprepared, one can easily think that to be a bug in the specific python script 
at hand (which it's not), or a chroot to be involved (which it's not, usually). 
So I consider this a bug.

On freenode/#python I was referred to 
https://github.com/python/cpython/blob/master/Modules/syslogmodule.c#L98 for 
the code that does this.

This issue is forwarded from a minor bug report reported by me at Debian: 
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=835577

A test script is attached, which, when called with absolute path, produces this 
in syslog:

  Aug 27 08:53:27 blackbox /test-syslog.py: Test from python!

The slash is misleading/wrong.

--
files: test-syslog.py
messages: 273770
nosy: canvon
priority: normal
severity: normal
status: open
title: Syslogs /usr/sbin/foo as /foo instead of as foo
type: behavior
Added file: https://bugs.python.org/file44240/test-syslog.py

___
Python tracker 

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



[issue27874] inconsistent sys.path behavior when using PythonXX.zip

2016-08-27 Thread Eryk Sun

Eryk Sun added the comment:

Windows Python determines sys.prefix (i.e. the location of the standard 
library, \lib) via either the PYTHONHOME environment variable or by 
searching for the landmark "lib/os.py", starting in the application directory 
and reducing back to the root directory [1]. 

If it can't find the prefix directory; PYTHONPATH isn't defined; and it can't 
find PythonPath in the registry; then it adds the "DLLs" and "lib" directories 
relative to the working directory. This default PYTHONPATH is defined in 
PC/pyconfig.h as ".\\DLLs;.\\lib".

There is an alternative "applocal" (application local) mode. Create a file 
named pyvenv.cfg beside python.exe that contains the single line 

applocal = true

This prevents Python from checking PYTHONHOME and PYTHONPATH, the registry, and 
prevents searching for the "lib/os.py" landmark. sys.prefix is set as the 
application directory, and the default "DLLs" and "lib" paths are expanded 
relative to the application directory.

Anyway, since what you're reporting is the expected behavior, I'm closing this 
issue. Feel free to reopen it if you feel I've misdiagnosed the problem or 
think the default behavior is somehow broken. I don't know what Steve Dower's 
plans are, if indeed he has any, to change the legacy sys.path behavior in 
future releases.


[1]: The reduce() function in PC/getpathp.c has a minor bug that
 results in sys.prefix set as the drive-relative path "C:" if 
 the landmark search continues to the root and "C:/lib/os.py" 
 exists. This is due to the way it overwrites the path separator 
 with NUL to reduce the path. I think it should keep the 
 separator. The join() function works either way.

--
nosy: +eryksun
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue27506] make bytes/bytearray translate's delete a keyword argument

2016-08-27 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 6ab1b54245d5 by Martin Panter in branch 'default':
Issue #27506: Support bytes/bytearray.translate() delete as keyword argument
https://hg.python.org/cpython/rev/6ab1b54245d5

--
nosy: +python-dev

___
Python tracker 

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



[issue26040] Improve coverage and rigour of test.test_math

2016-08-27 Thread Jeff Allen

Jeff Allen added the comment:

Mark: Thanks for validating the additional cases so carefully.

If you still want to apply it in stages then I suppose the change to the 
comparison logic could go first (untested idea), although that's also where I 
could most easily have made a mistake.

--

___
Python tracker 

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



[issue25825] AIX shared library extension modules installation broken

2016-08-27 Thread Martin Panter

Martin Panter added the comment:

Okay, the second patch is committed to 3.5+. Is everything working now (on 2.7, 
3.5, 3.6), or is there more to do?

--

___
Python tracker 

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



[issue19884] Importing readline produces erroneous output

2016-08-27 Thread Martin Panter

Martin Panter added the comment:

I committed my patch in full, so hopefully the Gnu Readline situation on OS X 
is also improved. Original fixes went into 3.4, but my patch only went into 
3.5+.

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.4

___
Python tracker 

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



[issue27874] inconsistent sys.path behavior when using PythonXX.zip

2016-08-27 Thread Joseph Shen

Joseph Shen added the comment:

second snapshot

--
Added file: https://bugs.python.org/file44239/2016-08-27_15-09-45.png

___
Python tracker 

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



[issue27874] inconsistent sys.path behavior when using PythonXX.zip

2016-08-27 Thread Joseph Shen

New submission from Joseph Shen:

Found a inconsistent sys.path result when python packed with it's library with 
zip package.

A. when NOT use zip package
   sys.path is base the python.exe's absolute path, result is 
1. ABS_PATH\pythonXX.zip
2. ABS_PATH\DLLs
3. ABS_PATH\lib, 
4. ABS_PATH
5. ABS_PATH\lib\site-packages

B. when use zip package
   sys.path is base the relative path of call path, result is 
1. ABS_PATH\pythonXX.zip
2. RLT_PATH\DLLs
3. RLT_PATH\lib, 
4. ABS_PATH

this is not commonly expected for the `DLLs` and `lib`, I think
the result will still be absolute path for where the executable
located. 

I snapshot two pictures for this problem, please review this,
thanks.

--
components: Windows
files: 2016-08-27_15-09-39.png
messages: 273763
nosy: Joseph.Shen, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: inconsistent sys.path behavior when using PythonXX.zip
type: behavior
versions: Python 3.5
Added file: https://bugs.python.org/file44238/2016-08-27_15-09-39.png

___
Python tracker 

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



[issue26439] ctypes.util.find_library fails when ldconfig/glibc not available (e.g., AIX)

2016-08-27 Thread Martin Panter

Martin Panter added the comment:

The documentation is in RST format in the Doc/ directory. For basic stuff, you 
can just copy the syntax from existing text, or see e.g. 
 for 
more hints. For this change, I think we need to mention in 
Doc/library/ctypes.rst:

* the special AIX changes for find_library(); include “.. versionchanged::” (or 
maybe versionadded? I’m not sure) notice
* the change for the CDLL constructor, also with versionchanged

Perhaps also add an entry to Doc/whatsnew/3.6.rst.

Patch 160823 does not addressed many of my previous comments. Please have a 
closer look. I can make simple changes to simplify the code myself, but I don’t 
really know what to do about the questionable regular expressions, for instance.

Also, see . What was wrong with 
the cases supported by your original patches?

--

___
Python tracker 

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