[issue33215] PyPI API wiki pages should be mutable

2018-04-03 Thread Ned Deily

Ned Deily  added the comment:

wiki.python.org pages aren't immutable.  Anyone can ask for Wiki editing 
permission.  See https://wiki.python.org/moin/:

If you want to edit a page and have just signed up, or you find that you can no 
longer edit a page that you could edit before, please write to the pydotorg-www 
mailing list, stating your account name and your intended edits and we'll add 
you to the EditorsGroup.

--

___
Python tracker 

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



[issue33215] PyPI API wiki pages should be mutable

2018-04-03 Thread Sumana Harihareswara

Sumana Harihareswara  added the comment:

The problem mgedmin is experiencing is that these particular wiki.python.org 
pages are immutable, which is not a problem Warehouse maintainers (like me) can 
solve, and I believe it's also not a problem people on distutils-sig can solve. 
Perhaps this is an infrastructure question that should go into 
https://github.com/python/psf-infra-meta/issues ?

--
title: PyPI API wiki pages could link to Warehous docs please -> PyPI API wiki 
pages should be mutable

___
Python tracker 

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



[issue33215] PyPI API wiki pages could link to Warehous docs please

2018-04-03 Thread Ned Deily

Ned Deily  added the comment:

You should probably bring this up on the packaging mailing list:

https://mail.python.org/mailman/listinfo/distutils-sig

or on the Warehouse issue tracker:

https://github.com/pypa/warehouse/issues

--
nosy: +ned.deily
resolution:  -> third party
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



[issue33216] Wrong order of stack for CALL_FUNCTION_VAR and CALL_FUNCTION_VAR_KW

2018-04-03 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

I confirm that this issue is 3.5-only. Before 3.5 the order matched the 
documentation. After 3.5 these opcodes were completely rewritten and they use 
now other way of passing arguments.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue33220] Antivirus hits on python-2.7.14.amd64.msi file

2018-04-03 Thread Ned Deily

Change by Ned Deily :


--
nosy: +paul.moore, steve.dower, tim.golden, zach.ware

___
Python tracker 

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



[issue33195] PyArg_Parse* should deprecate 'u' and 'z' family.

2018-04-03 Thread miss-islington

miss-islington  added the comment:


New changeset b8fc2d658094941250116a48577f54d1f6300362 by Miss Islington (bot) 
in branch '3.7':
bpo-33195: Doc: Deprecate Py_UNICODE in c-api/arg (GH-6329)
https://github.com/python/cpython/commit/b8fc2d658094941250116a48577f54d1f6300362


--
nosy: +miss-islington

___
Python tracker 

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



[issue33216] Wrong order of stack for CALL_FUNCTION_VAR and CALL_FUNCTION_VAR_KW

2018-04-03 Thread Ned Deily

Change by Ned Deily :


--
assignee: docs@python -> larry
nosy:  -ned.deily

___
Python tracker 

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



[issue33209] Repeated Pickler.dump() doesn't reset the state in the C implementation of pickle

2018-04-03 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
resolution:  -> fixed
stage: patch 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



[issue32337] Dict order is now guaranteed, so add tests and doc for it

2018-04-03 Thread miss-islington

miss-islington  added the comment:


New changeset 9216dffbc8a2aa62789f81f51f64bc1ec7bf6883 by Miss Islington (bot) 
in branch '3.7':
bpo-32337: Update documentats about dict order (GH-4973)
https://github.com/python/cpython/commit/9216dffbc8a2aa62789f81f51f64bc1ec7bf6883


--
nosy: +miss-islington

___
Python tracker 

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



[issue33195] PyArg_Parse* should deprecate 'u' and 'z' family.

2018-04-03 Thread miss-islington

Change by miss-islington :


--
pull_requests: +6080

___
Python tracker 

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



[issue33195] PyArg_Parse* should deprecate 'u' and 'z' family.

2018-04-03 Thread INADA Naoki

INADA Naoki  added the comment:


New changeset 42ec190761a2e8503aaa06f0bfaaabe98749179b by INADA Naoki in branch 
'master':
bpo-33195: Doc: Deprecate Py_UNICODE in c-api/arg (GH-6329)
https://github.com/python/cpython/commit/42ec190761a2e8503aaa06f0bfaaabe98749179b


--

___
Python tracker 

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



[issue32337] Dict order is now guaranteed, so add tests and doc for it

2018-04-03 Thread miss-islington

Change by miss-islington :


--
pull_requests: +6079

___
Python tracker 

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



[issue32337] Dict order is now guaranteed, so add tests and doc for it

2018-04-03 Thread INADA Naoki

INADA Naoki  added the comment:


New changeset dfbbbf16f9aab82330c634913441b5ac73267d9c by INADA Naoki (hui 
shang) in branch 'master':
bpo-32337: Update documentats about dict order (GH-4973)
https://github.com/python/cpython/commit/dfbbbf16f9aab82330c634913441b5ac73267d9c


--

___
Python tracker 

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



[issue32337] Dict order is now guaranteed, so add tests and doc for it

2018-04-03 Thread INADA Naoki

INADA Naoki  added the comment:

> I started to add this comment to #33218 but Raymond closed that ticket while 
> I was editing it.

Sorry, I closed it, not Raymond.

--

___
Python tracker 

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



[issue32337] Dict order is now guaranteed, so add tests and doc for it

2018-04-03 Thread Steven D'Aprano

Steven D'Aprano  added the comment:

I started to add this comment to #33218 but Raymond closed that ticket while I 
was editing it.

In 3.6, dicts preserving insertion order remains an implementation detail that 
cannot be relied on. It only becomes a guarantee in 3.7.

Even in 3.7, I think that it remains best to think of dicts as fundamentally 
unordered. Dicts might preserve insertion order, but there's no interface for 
extracting the n-th item, or re-ordering the keys into some alternative order, 
and for the purposes of equality comparisons, the order is ignored.

I propose changing the description from "It is best to think of a dictionary as 
an unordered set of key: value pairs" to something like:


Dicts are an otherwise unordered set of key:value pairs
that remember the order keys were inserted.


and references to "arbitrary order" should be replaced by "insertion order". 
But by no means should we suggest that dicts are fundamentally orderable 
(sortable).

--
nosy: +steven.daprano

___
Python tracker 

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



[issue33218] Fix instances in documentation where dictionaries are referenced as unordered

2018-04-03 Thread INADA Naoki

Change by INADA Naoki :


--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> Dict order is now guaranteed, so add tests and doc for it

___
Python tracker 

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



[issue33218] Fix instances in documentation where dictionaries are referenced as unordered

2018-04-03 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

Also check the 3.7 docs to see if this work has already been done.

It's unlikely that the 3.6 docs will change because it is considered a 
non-guaranteed implementation detail for 3.6.

--

___
Python tracker 

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



[issue33218] Fix instances in documentation where dictionaries are referenced as unordered

2018-04-03 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

Would you like to make a pull request or do you prefer for me to assign it to 
someone else?

--
nosy: +rhettinger
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



[issue33221] Add stats for asyncio task usage.

2018-04-03 Thread Joongi Kim

Joongi Kim  added the comment:

I like trio-style instrumentation API because it could be used for more generic 
purposes, not only for statistics.

This stats or instrumentation API will greatly help me to utilize external 
monitoring services such as Datadog in my production deployments.

--

___
Python tracker 

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



[issue33219] x in IntFlag() should test int x's inclusion in IntFlag

2018-04-03 Thread Nitish

Nitish  added the comment:

@Ethan Furman how can Flag do that? IntFlag can deal with int values too. Would 
it be possible to deal with int values in this case in Flag.__contains__?

--
nosy: +nitishch

___
Python tracker 

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



[issue33221] Add stats for asyncio task usage.

2018-04-03 Thread Joongi Kim

Change by Joongi Kim :


--
nosy: +achimnol

___
Python tracker 

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



[issue33217] x in enum.Flag() is True when x is no Flag

2018-04-03 Thread Ethan Furman

Ethan Furman  added the comment:

Strings are actually the odd-man out -- dicts, sets, lists, tuples, etc., all 
return False instead of raising TypeError.

The reason str raises an error is because `in`, for str, is a substring check, 
not a membership check.

--

___
Python tracker 

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



[issue33221] Add stats for asyncio task usage.

2018-04-03 Thread Andrew Svetlov

Andrew Svetlov  added the comment:

Well, event based solution is more powerful than just statistic collection.
Please keep me in the loop.

--

___
Python tracker 

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



[issue33221] Add stats for asyncio task usage.

2018-04-03 Thread Yury Selivanov

Yury Selivanov  added the comment:

> Yuri, what do you think about?

I plan to use contextvars module to introduce a full-blown tracing API to 
asyncio to selectively log events like tacks creations, event loop switching, 
IO done by transports etc.  The plan is to prototype it in uvloop first.

I'll update this issue with a link to a discussion.

--

___
Python tracker 

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



[issue33221] Add stats for asyncio task usage.

2018-04-03 Thread Nathaniel Smith

Nathaniel Smith  added the comment:

FYI, here's how trio handles such things – I'm sure it's not perfect, but might 
be useful for inspiration: 
https://trio.readthedocs.io/en/latest/reference-hazmat.html#instrument-api

--
nosy: +njs

___
Python tracker 

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



[issue33221] Add stats for asyncio task usage.

2018-04-03 Thread Alexander Mohr

Alexander Mohr  added the comment:

another idea would be neat to somehow plug into the stats so people can trace 
(ex: via datadog tracing) "slow" tasks, similarly to things that are outputted 
via PYTHONASYNCIODEBUG, however in this case be able to trace slow steps and 
also slow accumulated steps.  In this scenario you don't know which task will 
be slow and don't want to track every task.

--
nosy: +thehesiod

___
Python tracker 

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



[issue33211] lineno and col_offset are wrong on function definitions with decorators

2018-04-03 Thread Ethan Smith

Ethan Smith  added the comment:

There is also a relevant mypy bug report 
https://github.com/python/mypy/issues/3871. This seems like a common problem 
for tools working on the AST. The relevant code seems to be 
https://github.com/python/cpython/blob/master/Python/ast.c#L1695. 

Would a possible solution be adding a decorated_lineno attribute to decorated 
ast nodes?

--
nosy: +Ethan Smith

___
Python tracker 

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



[issue33221] Add stats for asyncio task usage.

2018-04-03 Thread Andrew Svetlov

New submission from Andrew Svetlov :

I suggest adding a `Task.stats()` method.
The method should return a dict with the task usage statistics.
Dict keys:
- total_time: a time between task creation and a moment of the call (or task 
finishing timestamp if the task has finished). The value includes a time for 
`await func()` waiting.
- real_time: a cumulative time for `Task._step()` executions
- switch_count: a count of `Task._step()` calls.

It can help with tasks activity analyzing.

Yuri, what do you think about?

--
components: asyncio
messages: 314905
nosy: asvetlov, yselivanov
priority: normal
severity: normal
status: open
title: Add stats for asyncio task usage.
versions: Python 3.8

___
Python tracker 

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



[issue33220] Antivirus hits on python-2.7.14.amd64.msi file

2018-04-03 Thread Brett Rasmussen

New submission from Brett Rasmussen :

The antivirus program 'AVG Business Edition' reported that the file 
python-2.7.14.amd64.msi contained "Trojan horse SCGeneric_c6.HJQ".

The virustotal.com web site reported a match on MD5
  370014d73c3059f610c27365def62058  for file python-2.7.14.amd64.msi

  (i.e. Baidu  Win32.Trojan.WisdomEyes.16070401...)

Hopefully these are just 'false positives' ?

Thanks,
BR

--
messages: 314904
nosy: brett.rasmus...@inl.gov
priority: normal
severity: normal
status: open
title: Antivirus hits on python-2.7.14.amd64.msi file
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



[issue33209] Repeated Pickler.dump() doesn't reset the state in the C implementation of pickle

2018-04-03 Thread miss-islington

miss-islington  added the comment:


New changeset a5c8830637cde632ab3bcf5475698dcf0fb0546d by Miss Islington (bot) 
in branch '3.6':
bpo-33209: End framing at the end of C implementation of pickle.Pickler.dump(). 
(GH-6363)
https://github.com/python/cpython/commit/a5c8830637cde632ab3bcf5475698dcf0fb0546d


--
nosy: +miss-islington

___
Python tracker 

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



[issue15088] PyGen_NeedsFinalizing is public, but undocumented

2018-04-03 Thread Cheryl Sabella

Cheryl Sabella  added the comment:

Thanks again, Antoine.  I'll see what I can come up with.  :-)

--

___
Python tracker 

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



[issue33217] x in enum.Flag() is True when x is no Flag

2018-04-03 Thread Dutcho

Dutcho  added the comment:

Ah, the mixin logic mentioned in 33219 solves most of my objections to 
returning False; agree that would make sense
Only remaining inconsistency would be with 1 in 'hello'

--

___
Python tracker 

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



[issue33217] x in enum.Flag() is True when x is no Flag

2018-04-03 Thread Dutcho

Dutcho  added the comment:

Fully agree that Flag.__contains__ must RETURN False or True; that's why I 
suggested it RAISES TypeError
The exception was to be consistent with e.g. Flag.__and__, which by returning 
NotImplemented transfers to type(other).__rand__, and assuming __rand__ cannot 
handle Flag and also returns NotImplemented, falls back to the interpreter 
raising TypeError. Also e.g. 1 in 'hello' raises TypeError.
For Flag, I wouldn't strongly oppose to False for other being a different type. 
However, classes derived from Flag could face issues, e.g. `class MyIntFlag 
(Flag, int): pass`.

--

___
Python tracker 

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



[issue33209] Repeated Pickler.dump() doesn't reset the state in the C implementation of pickle

2018-04-03 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset 74735e2a404949b2a0c17ac13a2de0e0cac6fc41 by Łukasz Langa (Miss 
Islington (bot)) in branch '3.7':
bpo-33209: End framing at the end of C implementation of pickle.Pickler.dump(). 
(GH-6366)
https://github.com/python/cpython/commit/74735e2a404949b2a0c17ac13a2de0e0cac6fc41


--

___
Python tracker 

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



[issue33209] Repeated Pickler.dump() doesn't reset the state in the C implementation of pickle

2018-04-03 Thread miss-islington

Change by miss-islington :


--
pull_requests: +6078

___
Python tracker 

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



[issue33209] Repeated Pickler.dump() doesn't reset the state in the C implementation of pickle

2018-04-03 Thread miss-islington

Change by miss-islington :


--
pull_requests: +6077

___
Python tracker 

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



[issue24960] Can't use lib2to3 with embeddable zip file.

2018-04-03 Thread Lukasz

Lukasz  added the comment:

I have simmilar problem but im using python 2.7 on android. So I think I cant 
use this solution 
My problem:
https://bugs.python.org/issue33208

--
nosy: +Lukasz00500

___
Python tracker 

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



[issue33209] Repeated Pickler.dump() doesn't reset the state in the C implementation of pickle

2018-04-03 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset c869529ea9fbed574d34cf7ac139ca3f81b62ef0 by Łukasz Langa (Serhiy 
Storchaka) in branch 'master':
bpo-33209: End framing at the end of C implementation of pickle.Pickler.dump(). 
(GH-6363)
https://github.com/python/cpython/commit/c869529ea9fbed574d34cf7ac139ca3f81b62ef0


--
nosy: +lukasz.langa

___
Python tracker 

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



[issue33219] x in IntFlag() should test int x's inclusion in IntFlag

2018-04-03 Thread Ethan Furman

Ethan Furman  added the comment:

issue33217 will not be "fixed" with a TypeError, but incorrect Falses are also 
bad.

Rather than add __contains__ to IntFlag (and every other Flag mixin), I think 
the best answer is to adjust Flag.__contains__ a little bit more to check if 
`other` is of the same type as the mixin class, and if so see if it's one of 
the values.

Thank you for being thorough and finding this problem as well.

--
keywords: +easy

___
Python tracker 

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



[issue33216] Wrong order of stack for CALL_FUNCTION_VAR and CALL_FUNCTION_VAR_KW

2018-04-03 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
nosy: +larry, ned.deily

___
Python tracker 

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



[issue33217] x in enum.Flag() is True when x is no Flag

2018-04-03 Thread Ethan Furman

Ethan Furman  added the comment:

Thanks for finding this!

However, TypeError, an exception, is not the correct type of answer -- the 
correct type of answer for a yes/no question is either True or False.

So the code should be changed from returning NotImplemented to returning False.

--
keywords: +easy

___
Python tracker 

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



[issue33219] x in IntFlag() should test int x's inclusion in IntFlag

2018-04-03 Thread Ethan Furman

Change by Ethan Furman :


--
assignee:  -> ethan.furman
nosy: +barry, eli.bendersky, ethan.furman
versions: +Python 3.8 -Python 3.6

___
Python tracker 

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



[issue33217] x in enum.Flag() is True when x is no Flag

2018-04-03 Thread Ethan Furman

Change by Ethan Furman :


--
assignee:  -> ethan.furman
nosy: +barry, eli.bendersky, ethan.furman
versions: +Python 3.7, Python 3.8

___
Python tracker 

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



[issue30891] importlib: _find_and_load() race condition on sys.modules[name] check

2018-04-03 Thread Guido van Rossum

Guido van Rossum  added the comment:

OK, this sounds much better: zipimport has problems and we should fix them,
presumably by getting Thomas's fixes (sans Google-isms, which may require
some effort). I don't believe Łukasz's recommendation "don't use it" is the
right attitude (though what he puts in Facebook's internal style guide is
his problem :-), and I don't believe that we're better off deprecating it.

--

___
Python tracker 

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



[issue33219] x in IntFlag() should test int x's inclusion in IntFlag

2018-04-03 Thread Dutcho

New submission from Dutcho :

While `enum.IntFlag.__and__` accepts an int arg `other` and converts it to 
`IntFlag` before masking, `enum.IntFlag.__contains__` handles an int arg 
`other` no different from a different type arg `other` (i.e. returns `True` in 
Python 3.6 due to issue 33217, but would raise `TypeError` after that's fixed):
>>> import enum
>>> ABC = enum.Flag('ABC', 'a, b, c')
>>> ac = ABC.a | ABC.c
>>> ABC.b in ac # works
False
>>> 2 in ac # should be the same; no exception due to issue 33217
True
>>> ac & 3 # works, equivalent to ac & ABC(3)


This is caused by a lack of specialized `IntFlag.__contains__`, so 
`Flag.__contains__` does the work. Can be fixed by adding a specialization, 
which (like in `IntFlag.__and__`) tests for `isinstance(other, (IntFlag, int))`.

>>> def __contains__(self, other):
... if not isinstance(other, (self.__class__, int)):
... return TypeError
... return other & self == other # conversion of int to IntFlag 
implicitly handled by IntFlag.__and__
>>> IntFlag.__contains__ = __contains__

--
components: Library (Lib)
messages: 314893
nosy: Dutcho
priority: normal
severity: normal
status: open
title: x in IntFlag() should test int x's inclusion in IntFlag
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



[issue33218] Fix instances in documentation where dictionaries are referenced as unordered

2018-04-03 Thread arjun v

New submission from arjun v :

In python 3.6 (and above hopefully), dictionary keys are going to be ordered, 
while their documentation still reference them as being unordered.

https://docs.python.org/3/tutorial/datastructures.html#dictionaries 

1: `It is best to think of a dictionary as an unordered set of key: value 
pairs,...`

2: `Performing list(d.keys()) on a dictionary returns a list of all the keys 
used in the dictionary, in arbitrary order..`

The examples should also be changed to reflect the same:
```
>>> tel = {'jack': 4098, 'sape': 4139}
>>> tel['guido'] = 4127
>>> tel
{'sape': 4139, 'guido': 4127, 'jack': 4098}
>>> tel['jack']
4098
>>> del tel['sape']
>>> tel['irv'] = 4127
>>> tel
{'guido': 4127, 'irv': 4127, 'jack': 4098}
>>> list(tel.keys())
['irv', 'guido', 'jack']
>>> sorted(tel.keys())
['guido', 'irv', 'jack']
>>> 'guido' in tel
True
>>> 'jack' not in tel
False
```

```
>>> dict([('sape', 4139), ('guido', 4127), ('jack', 4098)])
{'sape': 4139, 'guido': 4127, 'jack': 4098}
```

```
>>> dict(sape=4139, guido=4127, jack=4098)
{'sape': 4139, 'guido': 4127, 'jack': 4098}
```

--
assignee: docs@python
components: Documentation
messages: 314892
nosy: arjunv, docs@python
priority: normal
severity: normal
status: open
title: Fix instances in documentation where dictionaries are referenced as 
unordered
versions: Python 3.6, Python 3.7, Python 3.8

___
Python tracker 

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



[issue33216] Wrong order of stack for CALL_FUNCTION_VAR and CALL_FUNCTION_VAR_KW

2018-04-03 Thread Manuel Vazquez Acosta

Manuel Vazquez Acosta  added the comment:

Correction, the documentation for CALL_FUNCTION_VAR said:

Calls a function. *argc* is interpreted as in :opcode:`CALL_FUNCTION`. The top 
element on the stack contains the variable argument list, followed by keyword 
and positional arguments.


In a previous comment I pasted the version I'm putting in the PR.

--

___
Python tracker 

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



[issue33217] x in enum.Flag() is True when x is no Flag

2018-04-03 Thread Dutcho

New submission from Dutcho :

While `Flag() in Flag()` and `Flag() | Flag()` result in the expected outcomes, 
e.g. `str() in Flag()` unexpectedly returns `True`, whereas `Flag() | str()` as 
expected raises a TypeError.
>>> import enum
>>> ABC = enum.Flag('ABC', 'a, b, c')
>>> ac = ABC.a | ABC.c
>>> def test():
... for x in (*ABC, 'test'):
... print(x, end=' ')
... try:
... print(x in ac, end=' ')
... except TypeError as e:
... print(e, end=' ')
... try:
... print(x | ac)
... except TypeError as e:
... print(e)
>>> test()
ABC.a True ABC.c|a
ABC.b False ABC.c|b|a
ABC.c True ABC.c|a
test True unsupported operand type(s) for |: 'str' and 'ABC'

Likely cause is modelling of Flag.__contains__ after Flag.__and__ etc., which 
is incorrect as __contains__ doesn't have a reflected version like __and__ etc. 
have. The returned `NotImplemented` is therefore not handled by the 
interpreter, although it is converted to bool to satisfy __contains__ return 
type.

This can be fixed by redefinition of Flag.__contains__ to raise TypeError:
>>> def __contains__(self, other):
... if not isinstance(other, self.__class__):
... raise TypeError(f"unsupported operand type(s) for 'in': "
... f"{type(other).__qualname__!r} and 
{type(self).__qualname__!r}")
... return other & self == other
>>> enum.Flag.__contains__ = __contains__
>>> test()
ABC.a True ABC.c|a
ABC.b False ABC.c|b|a
ABC.c True ABC.c|a
test unsupported operand type(s) for 'in': 'str' and 'ABC' unsupported 
operand type(s) for |: 'str' and 'ABC'

--
components: Library (Lib)
messages: 314890
nosy: Dutcho
priority: normal
severity: normal
status: open
title: x in enum.Flag() is True when x is no Flag
type: behavior
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



[issue30891] importlib: _find_and_load() race condition on sys.modules[name] check

2018-04-03 Thread Barry A. Warsaw

Barry A. Warsaw  added the comment:

Take a look at https://bugs.python.org/issue25711 which wants to rewrite 
zipimport from scratch.  I took Serhiy's C->Python patch and turned it into a 
PR, but it would need a lot of love to get it into shape.

(Let's not even talk about https://bugs.python.org/issue32866 which caused me 
some pain during importlib.resources work.)

Pretty sure Thomas's rumored rewrite is still in C, and it solves problems like 
support for zip64 and comments, which we've run into also.

zipimport is crucial for single-file executable solutions like pex and our own 
soon-to-be-open-sourced tool, so it really can't go away.  Both of those still 
unpack wheels/eggs/sdists to a file system cache, not so much for speed but 
because shared libraries generally can't be imported from anything but a 
physical path (thanks to dlopen()).  I think Google has a patch for glibc that 
would solve that but there's some hesitation from the glibc maintainers to 
merge it (and then what about other platforms?).

--

___
Python tracker 

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



[issue33216] Wrong order of stack for CALL_FUNCTION_VAR and CALL_FUNCTION_VAR_KW

2018-04-03 Thread Manuel Vazquez Acosta

Change by Manuel Vazquez Acosta :


--
keywords: +patch
pull_requests: +6075
stage:  -> patch review

___
Python tracker 

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



[issue33216] Wrong order of stack for CALL_FUNCTION_VAR and CALL_FUNCTION_VAR_KW

2018-04-03 Thread Manuel Vazquez Acosta

New submission from Manuel Vazquez Acosta :

The documentation of the dis module says that:

  CALL_FUNCTION_VAR (argc)

   Calls a function. *argc* is interpreted as in CALL_FUNCTION. The
   top elements on the stack are the keyword arguments, followed by the
   variable argument list, and then the positional arguments.

However, inspecting the how ``f(b=1, *args)`` is actually compiled shows a 
different order:

   >>> import dis
   >>> dis.dis(compile('f(b=1, *args)', '<>', 'eval'))

  1   0 LOAD_NAME0 (f)
  3 LOAD_NAME1 (args)
  6 LOAD_CONST   0 ('b')
  9 LOAD_CONST   1 (1)
 12 CALL_FUNCTION_VAR  256 (0 positional, 1 keyword pair)
 15 RETURN_VALUE

Notice that the top of the stack contains the explicit keyword arguments.

The documentation of CALL_FUNCTION_VAR_KW is also incorrect.

--
assignee:  -> docs@python
components: +Documentation
nosy: +docs@python
title: CALL_FUNCTION_VAR -> Wrong order of stack for CALL_FUNCTION_VAR and 
CALL_FUNCTION_VAR_KW
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



[issue33216] CALL_FUNCTION_VAR

2018-04-03 Thread Manuel Vazquez Acosta

Change by Manuel Vazquez Acosta :


--
nosy: mvaled
priority: normal
severity: normal
status: open
title: CALL_FUNCTION_VAR

___
Python tracker 

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



[issue30891] importlib: _find_and_load() race condition on sys.modules[name] check

2018-04-03 Thread Brett Cannon

Brett Cannon  added the comment:

The other problem is zipimport is written in C and no one wants to deal with 
that headache if possible. ;) We actually tweaked the importlib.resources API 
specifically to avoid having to muck with zipimport's C code as it would have 
required major surgery otherwise. Thomas has also been saying he was planning 
to upstream the improvements he has made to zipimport internally at Google 
which also demotivates touching the code knowing that changes are planned.

As for Steve's comment, the tricky bit is zipfile has a bunch of dependencies, 
so it's not so simple to just freeze that one module  and wrap it with 
importlib to be able to load the stdlib from a zip file (which zipimport 
supports). Basically zip-reading code needs to be written that can be 
bootstrapped (C or Python), and then use that in importlib to be able to import 
the stdlib from a zip file.

I have also been toying with the idea of a zippath module that would take 
pathlib's API and apply it to zip files acting like a self-contained file 
system, but I have never bothered as zipfile's API is messy. The "all the time 
in the world" project would be making all of this come together in a release of 
Python by building off of each other: new code to read zip files written in 
freezable Python, use importlib to replace zipimport, and provide a pathlib API 
to work with zip files (which would probably be partially built for use by 
importlib).

If I drop my idea of putting a package on PyPI to do lazy importing I could 
look at tackling this for 3.8.

--

___
Python tracker 

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



[issue33215] PyPI API wiki pages could link to Warehous docs please

2018-04-03 Thread Sumana Harihareswara

Change by Sumana Harihareswara :


--
nosy: +sumanah

___
Python tracker 

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



[issue33215] PyPI API wiki pages could link to Warehous docs please

2018-04-03 Thread Marius Gedminas

New submission from Marius Gedminas :

Now that Warehouse is preparing to replace the old PyPI codebase I think it 
would be a good idea if the old PyPI API documentation pages on the Python wiki 
would link to the new Warehouse API documentation.

Specifically,

- https://wiki.python.org/moin/PyPISimple ought to link to 
https://warehouse.readthedocs.io/api-reference/legacy/

- https://wiki.python.org/moin/PyPIJSON ought to link to 
https://warehouse.readthedocs.io/api-reference/json/

- https://wiki.python.org/moin/PyPIXmlRpc ought to link to 
https://warehouse.readthedocs.io/api-reference/xml-rpc/

The wiki pages are immutable so I cannot do this myself.

(I'm not sure if this is the right bug tracker.  Apologies if I got it wrong!)

--
assignee: docs@python
components: Documentation
messages: 314886
nosy: docs@python, mgedmin
priority: normal
severity: normal
status: open
title: PyPI API wiki pages could link to Warehous docs please
type: enhancement

___
Python tracker 

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



[issue31201] make test: module test that failed doesn't exist

2018-04-03 Thread Steven Downum

Change by Steven Downum :


--
nosy: +steven.downum

___
Python tracker 

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



[issue33214] join method for list and tuple

2018-04-03 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

String concatenation: f'{a}{b}{c}'
List concatenation: [*a, *b, *c]
Tuple concatenation: (*a, *b, *c)
Set union: {*a, *b, *c}
Dict merging: {**a, **b, **c}

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue33189] pygettext doesn't work with f-strings

2018-04-03 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
keywords: +patch
pull_requests: +6074
stage:  -> patch review

___
Python tracker 

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



[issue33213] crypt function not hashing properly on Mac (uses a specific salt)

2018-04-03 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

> What's the return value of crypt.crypt("test", crypt.METHOD_SHA512) 

This is from my Mac (10.13.3):

$ python3.6
Python 3.6.4 (v3.6.4:d48ecebad5, Dec 18 2017, 21:07:28)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import crypt
>>> crypt.crypt("test", crypt.METHOD_SHA512)
'$6asQOJRqB1i2'
>>> crypt.crypt("test", crypt.METHOD_SHA512)
'$6asQOJRqB1i2'
>>> crypt.crypt("test", "$5")
'$5yVOkTkyRzn.'
>>> crypt.crypt("test", "$6")
'$6asQOJRqB1i2'
>>> crypt.crypt("test", "$7")
'$7tSOkvDyiL6U'
>>> crypt.crypt("test") == crypt.crypt("test")
False
>>> crypt.crypt("test", crypt.mksalt()) == crypt.crypt("test", crypt.mksalt())
False

--

___
Python tracker 

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



[issue33214] join method for list and tuple

2018-04-03 Thread Javier Dehesa

Javier Dehesa  added the comment:

Thanks Christian. I thought of join precisely because it performs conceptually 
the same function as with str, so the parallel between ''.join(), [].join() and 
().join() looked more obvious. Also there is os.path.join and 
PurePath.joinpath, so the verb seemed well-established. As for shared method 
names, index and count are present both in sequences and str - although it is 
true that these do return the same kind of object in any cases.

I'm not saying your points aren't valid, though. Your proposed way with extend 
is I guess about the same as list(itertools.chain(...)), which could be 
considered to be enough. I just feel that is not particularly convenient, 
especially for newer developers, which will probably gravitate towards sum(...) 
more than itertools or a nested generator expression, but I may be wrong.

--

___
Python tracker 

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



[issue33214] join method for list and tuple

2018-04-03 Thread Christian Heimes

Christian Heimes  added the comment:

join() is a bad choice, because new developers will confusing list.join with 
str.join.

We could turn list.extend(iterable) into list.extend(*iterable). Or you could 
just use extend with a chain iterator:

>>> l = []
>>> l.extend(itertools.chain([1], [2], [3]))
>>> l
[1, 2, 3]

--
nosy: +christian.heimes
versions: +Python 3.8

___
Python tracker 

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



[issue33214] join method for list and tuple

2018-04-03 Thread Javier Dehesa

New submission from Javier Dehesa :

It is pretty trivial to concatenate a sequence of strings:

''.join([str1, str2, ...])

Concatenating a sequence of lists is for some reason significantly more 
convoluted. Some current options include:

sum([lst1, lst2, ...], [])
[x for y [lst1, lst2, ...] for x in y]
list(itertools.chain(lst1, lst2, ...))

The first one being the less recomendable but more intuitive and the third one 
being the faster but most cumbersome (see 
https://stackoverflow.com/questions/49631326/why-is-itertools-chain-faster-than-a-flattening-list-comprehension
 ). None of these looks like "the one obvious way to do it" to me. Furthermore, 
I feel a dedicated concatenation method could be more efficient than any of 
these approaches.

If we accept that ''.join(...) is an intuitive idiom, why not provide the 
syntax:

[].join([lst1, lst2, ...])

And while we are at it:

().join([tpl1, tpl2, ...])

Like with str, these methods should only accept sequences of objects of their 
own class (e.g. we could do [].join(list(s) for s in seqs) if seqs contains 
lists, tuples and generators). The use case for non-empty joiners would 
probably be less frequent than for strings, but it also solves a problem that 
has no clean solution with the current tools. Here is what I would probably do 
to join a sequence of lists with [None, 'STOP', None]:

lsts = [lst1, lst2, ...]
joiner = [None, 'STOP', None]
lsts_joined = list(itertools.chain.from_iterable(lst + joiner for lst in 
lsts))[:-len(joiner)]

Which is awful and inefficient (I am not saying this is the best or only 
possible way to solve it, it is just what I, self-considered experienced Python 
developer, might write).

--
components: Library (Lib)
messages: 314881
nosy: Javier Dehesa
priority: normal
severity: normal
status: open
title: join method for list and tuple
type: enhancement

___
Python tracker 

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



[issue33193] Cannot create a venv on Windows when directory path contains dollar character

2018-04-03 Thread Wolfgang Maier

Wolfgang Maier  added the comment:

An exotic case, but it also affects Linux:

python3.7 -m venv 'at$test'
Error: Command '['/home/maier/at$test/bin/python3.7', '-Im', 'ensurepip', 
'--upgrade', '--default-pip']' returned non-zero exit status 2.
[maier@nb19 ~]$ mkdir 'at$test'
mkdir: cannot create directory ‘at$test’: File exists
[maier@nb19 ~]$ cd 'at$test'
[maier@nb19 at$test]$ bin/python -m ensurepip
Collecting setuptools
Collecting pip
Installing collected packages: setuptools, pip
Exception:
Traceback (most recent call last):
  File "/usr/lib64/python3.7/distutils/util.py", line 187, in subst_vars
return re.sub(r'\$([a-zA-Z_][a-zA-Z_0-9]*)', _subst, s)
  File "/usr/lib64/python3.7/re.py", line 198, in sub
return _compile(pattern, flags).sub(repl, string, count)
  File "/usr/lib64/python3.7/distutils/util.py", line 184, in _subst
return os.environ[var_name]
  File "/usr/lib64/python3.7/os.py", line 678, in __getitem__
raise KeyError(key) from None
KeyError: 'test'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/tmp/tmpppaapmyk/pip-9.0.1-py2.py3-none-any.whl/pip/basecommand.py", 
line 215, in main
status = self.run(options, args)
  File 
"/tmp/tmpppaapmyk/pip-9.0.1-py2.py3-none-any.whl/pip/commands/install.py", line 
342, in run
prefix=options.prefix_path,
  File "/tmp/tmpppaapmyk/pip-9.0.1-py2.py3-none-any.whl/pip/req/req_set.py", 
line 784, in install
**kwargs
  File 
"/tmp/tmpppaapmyk/pip-9.0.1-py2.py3-none-any.whl/pip/req/req_install.py", line 
851, in install
self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
  File 
"/tmp/tmpppaapmyk/pip-9.0.1-py2.py3-none-any.whl/pip/req/req_install.py", line 
1064, in move_wheel_files
isolated=self.isolated,
  File "/tmp/tmpppaapmyk/pip-9.0.1-py2.py3-none-any.whl/pip/wheel.py", line 
247, in move_wheel_files
prefix=prefix,
  File "/tmp/tmpppaapmyk/pip-9.0.1-py2.py3-none-any.whl/pip/locations.py", line 
153, in distutils_scheme
i.finalize_options()
  File "/usr/lib64/python3.7/distutils/command/install.py", line 307, in 
finalize_options
self.expand_basedirs()
  File "/usr/lib64/python3.7/distutils/command/install.py", line 486, in 
expand_basedirs
self._expand_attrs(['install_base', 'install_platbase', 'root'])
  File "/usr/lib64/python3.7/distutils/command/install.py", line 480, in 
_expand_attrs
val = subst_vars(val, self.config_vars)
  File "/usr/lib64/python3.7/distutils/util.py", line 189, in subst_vars
raise ValueError("invalid variable '$%s'" % var)
ValueError: invalid variable '$'test''

So the venv actually gets created, but it's ensurepip which chokes on the $.

--
nosy: +wolma
versions: +Python 3.7, Python 3.8

___
Python tracker 

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



[issue30891] importlib: _find_and_load() race condition on sys.modules[name] check

2018-04-03 Thread Steve Dower

Steve Dower  added the comment:

I recommend and use it without trouble, but then I rarely defer imports to 
worker threads.

Barry may have some ideas, but I think this really shouldn't be difficult to 
do. importlib is pretty extensible, and it's not difficult to read from a zip 
file.

--
nosy: +barry

___
Python tracker 

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



[issue33189] pygettext doesn't work with f-strings

2018-04-03 Thread Riccardo Polignieri

Riccardo Polignieri  added the comment:

> the error should be better

Yes, that's what I maeant - sorry I should have phrased better. 
I marked by mistake a couple of f-strings for translation and totally forgot 
about it for a while... it took me some time to figure out what was going on 
with this NameError popping out of nowhere.

Curiously, xgettext handles this thing better (...or, far worse actually): it 
just parses the f-string as a regular one, producing something like
msgid "hello {x}"
msgstr ""
But then of course Python will fail *silently* at runtime, never picking up the 
translated version of the string...

--

___
Python tracker 

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



[issue33034] urllib.parse.urlparse and urlsplit not raising ValueError for bad port

2018-04-03 Thread Matt Eaton

Matt Eaton  added the comment:

Wanted to check in on this to see if there was any feedback on this topic?

--

___
Python tracker 

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



[issue33181] SimpleHTTPRequestHandler shouldn't redirect to directories with code 301

2018-04-03 Thread Matt Eaton

Matt Eaton  added the comment:

Wanted to check in on this to see if there was any feedback by any community or 
core members?

--

___
Python tracker 

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



[issue33213] crypt function not hashing properly on Mac (uses a specific salt)

2018-04-03 Thread Ron Reiter

Change by Ron Reiter :


--
title: crypt function not hashing properly -> crypt function not hashing 
properly on Mac (uses a specific salt)

___
Python tracker 

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



[issue33213] crypt function not hashing properly

2018-04-03 Thread Ron Reiter

Ron Reiter  added the comment:

Also:
>>> crypt.crypt("test", "$5")
'$5yVOkTkyRzn.'
>>> crypt.crypt("test", "$6")
'$6asQOJRqB1i2'
>>> crypt.crypt("test", "$7")
'$7tSOkvDyiL6U'

So the salt is "$6"

--

___
Python tracker 

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



[issue33213] crypt function not hashing properly

2018-04-03 Thread Ron Reiter

Ron Reiter  added the comment:

Python 3.6.4 (default, Mar 22 2018, 23:35:12)
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.39.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import crypt
>>> crypt.crypt("test", crypt.METHOD_SHA512)
'$6asQOJRqB1i2'
>>> crypt.crypt("test", crypt.METHOD_SHA512)
'$6asQOJRqB1i2'

--

___
Python tracker 

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



[issue33213] crypt function not hashing properly

2018-04-03 Thread Christian Heimes

Christian Heimes  added the comment:

The crypt module is a thin wrapper around the OS' crypt(3) function. The 
function should return NULL for unsupported salt types. The module turns NULL 
into None.

What's the return value of crypt.crypt("test", crypt.METHOD_SHA512) ?

--
nosy: +christian.heimes

___
Python tracker 

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



[issue33213] crypt function not hashing properly

2018-04-03 Thread Ron Reiter

Ron Reiter  added the comment:

Apparently it's a Mac issue. My crypt.methods only contains 
[] which is probably why this fails. It's a silent failure 
of some sort that is causing this.

--

___
Python tracker 

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



[issue33213] crypt function not hashing properly

2018-04-03 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

I can't reproduce this result. Does your os.urandom() broken and return a short 
repeated sequence?

--
nosy: +mark.dickinson, rhettinger, serhiy.storchaka

___
Python tracker 

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



[issue33203] random.choice: raise IndexError on empty sequence even when not using getrandbits internally

2018-04-03 Thread Wolfgang Maier

Wolfgang Maier  added the comment:

@selik: it's true _randbelow doesn't work for negative numbers, but the 
difference is that both branches are affected, the docstring does not make any 
guarantees about it, and no public part of the random module is affected by 
this behavior. In addition, "fixing" _randbelow for negative input cannot be 
done without impacting performance of several public methods of random.Random 
so I don't think this should be done.

--

___
Python tracker 

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



[issue33203] random.choice: raise IndexError on empty sequence even when not using getrandbits internally

2018-04-03 Thread Wolfgang Maier

Wolfgang Maier  added the comment:

@rhettinger: the reason the ValueError gets raised correctly in the 
getrandbits-dependent branch is because getrandbits itself does a n<=0 check 
(in C for random.Random, in Python for random.SystemRandom).
So I thought the real reason why _randbelow does not perform the check was that 
it would be redundant, which it isn't when only random is used.

So instead of thinking about the suggested check as something that impacts 
performance (which certainly it does), I would rather see it as adding 
something into that second branch that was forgotten and gave that branch a 
performance benefit over the other one, which it never deserved.
It is also worthwhile to remember that any performance impact of this will only 
hit subclasses of random.Random that define random, but not getrandbits. Your 
alternative idea of having random.choice catch (ValueError, ZeroDivisionError) 
would affect random.Random and all subclasses.
If a subclass defines getrandbits, it needs to perform that check anyway  and, 
thinking about this more, I suggest that the requirement for any user-provided 
getrandbits to raise ValueError on k <= 0 should actually be added to the 
getrandbits docs.

--

___
Python tracker 

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



[issue33213] crypt function not hashing properly

2018-04-03 Thread Ron Reiter

Ron Reiter  added the comment:

You guessed it, the salt is "$6"

--

___
Python tracker 

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



[issue33213] crypt function not hashing properly

2018-04-03 Thread Ron Reiter

Ron Reiter  added the comment:

import crypt

Expected result:
>>> crypt.crypt("test") == crypt.crypt("test")
False
>>> crypt.crypt("test", crypt.mksalt()) == crypt.crypt("test", crypt.mksalt())
False

Unexpected results:
>>> crypt.crypt("test", crypt.METHOD_SHA512) == crypt.crypt("test", 
>>> crypt.METHOD_SHA512)
True
>>> crypt.crypt("test", crypt.mksalt(crypt.METHOD_SHA512)) == 
>>> crypt.crypt("test", crypt.mksalt(crypt.METHOD_SHA512))
True

--

___
Python tracker 

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



[issue33213] crypt function not hashing properly

2018-04-03 Thread Ron Reiter

New submission from Ron Reiter :

import crypt

Expected result:
>>> crypt.crypt("test") == crypt.crypt("test")
False
>>> crypt.crypt("test", crypt.mksalt()) == crypt.crypt("test", crypt.mksalt())
False

Unexpected results:
>>> crypt.crypt("test", crypt.METHOD_SHA512) == crypt.crypt("test", 
>>> crypt.METHOD_SHA512)
True
>>> crypt.crypt("test", crypt.mksalt(crypt.METHOD_SHA512)) == 
>>> crypt.crypt("test", crypt.mksalt(crypt.METHOD_SHA512))
False

--
components: Extension Modules
messages: 314866
nosy: Ron Reiter
priority: normal
severity: normal
status: open
title: crypt function not hashing properly
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



[issue33195] PyArg_Parse* should deprecate 'u' and 'z' family.

2018-04-03 Thread INADA Naoki

INADA Naoki  added the comment:

OK, I replaced Py_UNICODE with wchar_t in Py_BuildValue document.

--

___
Python tracker 

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



[issue33211] lineno and col_offset are wrong on function definitions with decorators

2018-04-03 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

See how similar issue was solved in Pyflakes: 
https://github.com/PyCQA/pyflakes/pull/273.

Python tests also needed special workaround, see Lib/test/test_sys_settrace.py 
and issue17288.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue33209] Repeated Pickler.dump() doesn't reset the state in the C implementation of pickle

2018-04-03 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
pull_requests: +6073

___
Python tracker 

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



[issue33212] add several options to msgfmt.py

2018-04-03 Thread umedoblock

umedoblock  added the comment:

Sorry, I forgot to add a patch file.

--
keywords: +patch
Added file: https://bugs.python.org/file47518/a.patch

___
Python tracker 

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



[issue33212] add several options to msgfmt.py

2018-04-03 Thread umedoblock

New submission from umedoblock :

= Why do I add several options ?
I'd like to effectively know a progress of translate about some po files
when KiCad dev team announce to public KiCad 5.0 major.
Because KiCad dev team separates PCB design tools to exe files.
And I used the poedit to translate work.
Then I'd like to know progress per a po file.

Please take my idea in msgfmt.py.

== help
{{{
Usage: msgfmt.py [OPTIONS] filename.po

Options:
...
-d
--dump
Show all msg_id_NO, msgid and msgstr in filename.po.

-p
--progress
Show translate progress.

-r
--remaining
Show no translated msgid with msg_id_NO.
...
}}}

== progress option
{{{
$ python3 ~/KiCad/kicad-doc/src/translate-set/msgfmt.py --progress 
~/KiCad/kicad-doc/src/eeschema/po/ja.po 
translated: 1151 of 1427 (80%), Remaining: 276
}}}

== dump option
{{{
$ python3 ~/KiCad/kicad-doc/src/translate-set/msgfmt.py --dump 
~/KiCad/kicad-doc/src/eeschema/po/ja.po | head -20
msg_id_NO=1
Eeschema
Eeschema

msg_id_NO=2
_Reference manual_
_リファレンス・マニュアル_ 

msg_id_NO=3
*Copyright*

*著作権*
...
}}}

== remaining option
{{{
$ python3 ~/KiCad/kicad-doc/src/translate-set/msgfmt.py --remaining 
~/KiCad/kicad-doc/src/eeschema/po/ja.po | head -20
msg_id_NO=4
This document is Copyright (C) 2010-2018 by its contributors as listed below. Yo
u may distribute it and/or modify it under the terms of either the GNU General 
Public License (http://www.gnu.org/licenses/gpl.html), version 3 or later, or 
the Creative Commons Attribution License 
(http://creativecommons.org/licenses/by/3.0/), version 3.0 or later.

msg_id_NO=12
About KiCad translation: https://github.com/KiCad/kicad-i18n/issues

msg_id_NO=14
Published on May 30, 2015.

msg_id_NO=15
Symbol Annotation Tool
...
}}}

--
components: Demos and Tools
files: msgfmt.py
messages: 314862
nosy: umedoblock
priority: normal
severity: normal
status: open
title: add several options to msgfmt.py
type: enhancement
versions: Python 3.6
Added file: https://bugs.python.org/file47517/msgfmt.py

___
Python tracker 

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



[issue32360] Save OrderedDict imports in various stdlibs.

2018-04-03 Thread INADA Naoki

Change by INADA Naoki :


--
dependencies:  -Dict order is now guaranteed, so add tests and doc for it
stage: patch 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