Re: Anonymous email users

2024-06-25 Thread Anton Shepelev via Python-list
Chris Angelico to dn:

> > Python mailing-lists are covered by the Code of Conduct
> > and monitored by ListAdmins. Thus, there are controls
> > which limit the impact which advertisers and others with
> > non-pythonic aims might otherwise exert!
>
> So long as there's a newsgroup gateway, those controls are
> toothless.

The gateway operator can have the usual anti-spam software
installed, and of course there is Gmane:

  

which actually subscribes users to mailing lists (on their
behalf).  Gmane's NNTP server is: news.gmane.io .

-- 
()  ascii ribbon campaign -- against html e-mail
/\  www.asciiribbon.org   -- against proprietary attachments
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Anonymous email users

2024-06-25 Thread Anton Shepelev via Python-list
Sebastian Wells:

> The spammers won the spam wars, so even if you have
> someone's real e-mail address, that's no guarantee that
> you can contact them.

No so with me.  My e-mail address here is munged, but in a
very obvious way, and no, my mailbox is not overwhelmed with
spam.

I make a habit of reporting spam via:

  1.  https://www.spamcop.net/anonsignup.shtml
  2.  https://submit.spamhaus.org/submit/

They maintain blacklists of e-mail providers or notify them
of spam e-mails.  It helps.

-- 
()  ascii ribbon campaign -- against html e-mail
/\  www.asciiribbon.org   -- against proprietary attachments
-- 
https://mail.python.org/mailman/listinfo/python-list


Introspecting the variable bound to a function argument

2023-02-22 Thread Anton Shepelev
Hello, all.

Does Python have an instrospection facility that can
determine to which outer variable a function argument is
bound, e.g.:

   v1 = 5;
   v2 = 5;

   def f(a):
   print(black_magic(a)) # or black_magic('a')

   f(v1) # prints: v1
   f(v2) # prints: v2

-- 
()  ascii ribbon campaign -- against html e-mail
/\  www.asciiribbon.org   -- against proprietary attachments
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue43463] typing.get_type_hints with TYPE_CHECKING imports / getting hints for single argument

2022-03-20 Thread Anton Agestam


Anton Agestam  added the comment:

As a consumer of `get_type_hints()` I think it'd be valuable to even have 
partially resolved types. My use case is that I provide an `Annotated` alias 
with a marker, and all I care about when inspecting user type hints is whether 
or not the arguments of an `Annotated` type contains my marker object. So 
ideally the fallback to an unresolved string or a sentinel object such as the 
proposed `typing.Unresolvable` should happen at the "lowest resolvable level" 
so that what can be resolved isn't lost.


By example, I'm saying that I think that this code:

marker = object()

def dec(cls):
print(get_type_hints(cls))
return cls

@dec
class A(abc.ABC):
forward: Annotated[B, marker]

class B:
...

Should produce:

{"forward": Annotated[Unresolvable["B"], marker]}

I guess this would apply in situations where for instance a part of a union 
isn't resolvable too. If we have a union A|B where A is resolvable and B isn't, 
it should be resolved to:

A | Unresolvable["B"]

And not to:

Unresolvable["A | B"]

(I think for this perspective it's irrelevant whether unresolved types have a 
sentinel type or are just represented as strings).

(Here's the library that's my use case for the curious: 
https://github.com/antonagestam/abcattrs)

--
nosy: +antonagestam

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



[issue39100] email.policy.SMTP throws AttributeError on invalid header

2022-01-30 Thread Anton Khirnov


Anton Khirnov  added the comment:

Ping yet again. Can anyone please look at this?

--

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



[issue46052] Ctrl+C, C+V in IDLE on Windows do not work with Cyrillic keys

2021-12-12 Thread Anton Bryl


Anton Bryl  added the comment:

> Also, how do you make your keyboard a Cyrillic keyboard.

On Windows, just install a keyboard layout for e.g. Russian. As soon as you 
switch to it, all Ctrl+Letter combinations stop working. Switch back to EN, and 
everything's working again.

As the code is written in Latin alphabet, it's only rarely a problem, but, as I 
mentioned, sometimes one needs to edit string constants, and then it's an 
inconvenience (normally the exact same key combinations work).

--

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



[issue46052] Ctrl+C, C+V in IDLE on Windows do not work with Cyrillic keys

2021-12-12 Thread Anton Bryl


Anton Bryl  added the comment:

Tried the tkinter example.
The exact same problem occurs there as well: when a Cyrillic layout is on, 
Ctrl+Letter combinations do not work (it's in fact not just Ctrl+C and Ctrl+V, 
but apparently all of them).

--

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



[issue46052] Ctrl+C, Ctrl+V in IDLE on Windows do not work with Cyrillic keyboard layout

2021-12-11 Thread Anton Bryl


New submission from Anton Bryl :

Ctrl+C and Ctrl+V key combinations in IDLE on Windows do not work with Cyrillic 
keyboard layout. It is unexpected, as well as inconvenient when editing string 
constants.

--
assignee: terry.reedy
components: IDLE
messages: 408345
nosy: anton.bryl, terry.reedy
priority: normal
severity: normal
status: open
title: Ctrl+C, Ctrl+V in IDLE on Windows do not work with Cyrillic keyboard 
layout
type: behavior
versions: Python 3.9

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



[issue15373] copy.copy() does not properly copy os.environment

2021-09-21 Thread Anton Barkovsky


Change by Anton Barkovsky :


--
nosy:  -anton.barkovsky

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



[issue45158] Refactor traceback.py to make TracebackException more extensible.

2021-09-09 Thread Anton Abrosimov


Anton Abrosimov  added the comment:

I think now is a good time for such a change. `FrameSummary`,` StackSummary` 
and `TracebackException` can be left backward compatible. And PEP 657 already 
breaks backward compatibility of output parsers.

--

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



[issue45158] Refactor traceback.py to make TracebackException more extensible.

2021-09-09 Thread Anton Abrosimov


New submission from Anton Abrosimov :

1. Move internal dependencies (`FrameSummary`, `StackSummary`) to class 
attributes. Reduce coupling.
2. Separate receiving, processing and presenting traceback information.
How to replace `repr` with `pformat` in `FrameSummary`?
def __init__(...):
...
self.locals = {k: repr(v) for k, v in locals.items()} if locals else None
...
3. Move formatting templates to class attributes.
4. ...

Motivation:
1. For the sake of small changes to the view, you have to rewrite the entire 
`TracebackException` hierarchy. Or use string parsing.
2.1. During development, I want to see as much information as possible.
2.2. During production, displaying unnecessary information can lead to security 
problems.
2.3. In large projects, it is more convenient to use JSON for further 
processing in the system environment.

I have not found any PEPs describing `traceback.py`.
I can make a prototype of the changes if anyone is interested.

--
components: Library (Lib)
messages: 401528
nosy: abrosimov.a.a
priority: normal
severity: normal
status: open
title: Refactor traceback.py to make TracebackException more extensible.
type: enhancement
versions: Python 3.11

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



[issue44803] change tracemalloc.BaseFilter to an abstract class

2021-08-05 Thread Anton Grübel

Anton Grübel  added the comment:

Even it is a private method, it is essential, when you use 
Snapshot.filter_traces(). Creating a Filter without implementing this method 
will just result in a runtime error.

https://github.com/python/cpython/blob/029cb4a6adacb650dbfc8ea71d2875ab771fe92e/Lib/tracemalloc.py#L442-L451

For me it feels like a bad practice to just recommend the developer to 
implement this method instead of enforcing it. Why is there a possibility to 
state clearly that a class is an abstract class and not use it? Even PEP20 
states, "Explicit is better than implicit."

So why is there a way to create an abstract class in Python, just for fun? I 
don't think so, it is to make the intent very clear. As said, there is probably 
a lot of old code laying around in Python, which could be modernized by using 
functionality of newer Python versions, so why not change it? Is there actually 
any drawback in defining this class as an abstract class or do you actually 
gain more, because everyone directly understands that an abstract method has to 
be implemented in the subclass.

@Lukasz: if you ask me, I would change all of them, but I'm definitely lacking 
the skill and experience to find all those flaws and fix them. I'm happy to 
help and for me making code better even it is small is always appreciated, if 
you always think it is not worth the trouble or nothing really to gain, then it 
will stay that way and more and more of those constructs will arise. In Germany 
we have a saying, small cattle also make muck :D

But thanks for taking a look, even it was not worth the trouble. I had fun  
creating the PR, but you can just do what you like with it.

--

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



[issue44803] change tracemalloc.BaseFilter to an abstract class

2021-08-01 Thread Anton Grübel

Change by Anton Grübel :


--
keywords: +patch
pull_requests: +26042
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/27527

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



[issue44803] change tracemalloc.BaseFilter to an abstract class

2021-08-01 Thread Anton Grübel

New submission from Anton Grübel :

during some work on typeshed I found the BaseFilter class in tracemalloc and it 
totally looks like and is used as a typical abstract class.

I will also directly create the PR :) if you think I'm missing something, I'm 
happy to hear some other thoughts.

--
components: Library (Lib)
messages: 398699
nosy: anton.gruebel
priority: normal
severity: normal
status: open
title: change tracemalloc.BaseFilter to an abstract class
type: enhancement
versions: Python 3.11

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



[issue44711] Optimize type check in pipes.py

2021-07-29 Thread Anton Grübel

Anton Grübel  added the comment:

I'm still super happy to had the chance to contribute a bit to Python and it 
will be available already in version 3.10 <3

Thanks Serhiy & Lukasz!

--

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



[issue44711] Optimize type check in pipes.py

2021-07-22 Thread Anton Grübel

Anton Grübel  added the comment:

I know that :) , it is just weird to do also do the type check on an empty 
string, which can be replaced with str directly, but as far as I know it is 
usually better to use isinstance instead of type.

--

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



[issue44711] Optimize type check in pipes.py

2021-07-22 Thread Anton G.


New submission from Anton G. :

When I did some work on typeshed I found some weird syntax in pipes.py.

if type(cmd) is not type(''):

which can easily be changed to

if not isinstance(cmd, str):

There are two occurrences and I will directly create the PR :)

--
components: Library (Lib)
messages: 397995
nosy: anton.gruebel
priority: normal
severity: normal
status: open
title: Optimize type check in pipes.py
type: performance

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



[issue39100] email.policy.SMTP throws AttributeError on invalid header

2021-07-07 Thread Anton Khirnov


Anton Khirnov  added the comment:

Quoting Andrei Kulakov (2021-07-03 16:03:34)
> Anton: thanks for the report! In the message you say you are not sure
> of the solution, and because of that not sending a patch, but then you
> created the PR; - please clarify.

I didn't send a patch when originally submitting the bugreport in 2019.
I did write a patch about a year later, since there was no response to
the bugreport.

--

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



[issue39100] email.policy.SMTP throws AttributeError on invalid header

2021-07-07 Thread Anton Khirnov


Anton Khirnov  added the comment:

Quoting R. David Murray (2021-07-06 18:59:56)
> How are you encountering this error?  The following program runs without 
> exception for me on master:
> 
> from email import message_from_binary_file
> from email.policy import SMTP
> 
> msg = message_from_binary_file(open('mail.eml', 'rb'), policy=SMTP)
> print(msg)

The exception is thrown on accessing the 'to' header, so make that
print(msg['to'])

--

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



[issue43336] document whether io.TextIOBase.readline(size>0) will always read the full newline

2021-03-17 Thread Christoph Anton Mitterer


Christoph Anton Mitterer  added the comment:

I guess that the translation from CRLF to LF simply happens before the size 
restriction is enforced (which is good so, btw), so effectively it:

will not *read* at most size characters from the stream, but *return* at most 
size characters from it (with any newlines translated before, and thus more 
characters read from the stream than returned)

--

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



[issue43501] email._header_value_parse throws AttributeError on display name ending with dot

2021-03-15 Thread Anton Khirnov


Change by Anton Khirnov :


--
keywords: +patch
pull_requests: +23636
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/24874

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



[issue43501] email._header_value_parse throws AttributeError on display name ending with dot

2021-03-15 Thread Anton Khirnov


New submission from Anton Khirnov :

On parsing an email where the display name in an address ends on a dot 
immediately followed by angle-addr, accessing the resulting mailbox 
display_name throws
/usr/lib/python3.9/email/_header_value_parser.py in value(self)
589 if self[0].token_type=='cfws' or 
self[0][0].token_type=='cfws':
590 pre = ' '
--> 591 if self[-1].token_type=='cfws' or 
self[-1][-1].token_type=='cfws':
592 post = ' '
593 return pre+quote_string(self.display_name)+post

AttributeError: 'str' object has no attribute 'token_type'

The problem is that self[-1] is the terminal DOT.

An example of the problematic header is:
From: foobar.

--
components: email
messages: 388738
nosy: barry, elenril, r.david.murray
priority: normal
severity: normal
status: open
title: email._header_value_parse throws AttributeError on display name ending 
with dot
type: behavior
versions: Python 3.10, Python 3.6, Python 3.7, Python 3.8, Python 3.9

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



[issue39100] email.policy.SMTP throws AttributeError on invalid header

2021-03-15 Thread Anton Khirnov


Change by Anton Khirnov :


--
keywords: +patch
pull_requests: +23633
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/24872

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



[issue43337] export the set newline value on TextIOBase/TextIOWrapper

2021-02-26 Thread Christoph Anton Mitterer


New submission from Christoph Anton Mitterer :

Hey.

It seems there is no way to determine the newline value (None, '', \n, \r, 
\r\n) of a given text stream.
.newlines rather gives the newlines that have been encountered so far.


Just like .encoding and .errors this would be quite useful for anything that 
gets a stream and operates on it, possibly needing to know which newlines it 
will see when reading from the stream.

One example would be, after line = stream.readline(4096+n) one want's to know 
whether actually a full line of 4096 characters has been read.
Putting aside newline="", for simplicity here, n already depends on whether 
newline was None, \n, \r or \r\n, as would any check like line.endswith(foo).


Maybe some attribute, that indicates the most recently read newline in 
newline="" mode, would be helpful, too.


Cheers,
Chris.

--
components: IO
messages: 387767
nosy: calestyo
priority: normal
severity: normal
status: open
title: export the set newline value on TextIOBase/TextIOWrapper
type: enhancement

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



[issue43336] document whether io.TextIOBase.readline(size>0) will always read the full newline

2021-02-26 Thread Christoph Anton Mitterer


Christoph Anton Mitterer  added the comment:

"a n > 0size" should have read "a size > 0"

--

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



[issue43336] document whether io.TextIOBase.readline(size>0) will always read the full newline

2021-02-26 Thread Christoph Anton Mitterer


New submission from Christoph Anton Mitterer :

Hey.

It would be nice if the following behaviour could be definitely clarified:

When reading from a text stream with readline(size) with a n > 0size it says: 
"If size is specified, at most size characters will be read."

Also, depending on the settings of newlines of the stream, \r\n would be 
converted to \n.


It's not definitely clear whether a string like
"abc\r\n"
read with a size of = 4 will return "abc\n" (which it seems to do, in other 
words, it reads actually 5 characters, but sill returns only 4), or whether it 
returns "abc\r".


Cheers,
Chris.

--
assignee: docs@python
components: Documentation
messages: 387758
nosy: calestyo, docs@python
priority: normal
severity: normal
status: open
title: document whether io.TextIOBase.readline(size>0) will always read the 
full newline

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



[issue1152248] Add support for reading records with arbitrary separators to the standard IO stack

2021-02-22 Thread Christoph Anton Mitterer


Christoph Anton Mitterer  added the comment:

btw, just something for the record:

I think the example given in msg109117 above is wrong:

Depending on the read size it will produce different results, given how split() 
works:

Imagine a byte sequence:
>>> b"\0foo\0barbaz\0\0abcd".split(b"\0")
[b'', b'foo', b'barbaz', b'', b'abcd']


Now the same sequence, however with a different read size (here a shorter one):
>>> b"\0foo\0barbaz\0".split(b"\0")
[b'', b'foo', b'barbaz', b'']
>>> b"\0abcd".split(b"\0")
[b'', b'abcd']

=> it's the same bytes, but in the 2nd case one get's an extra b''.

--

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



[issue1152248] Add support for reading records with arbitrary separators to the standard IO stack

2021-02-22 Thread Christoph Anton Mitterer


Christoph Anton Mitterer  added the comment:

Oh, what a pity,... 

Seemed like a pretty common use case, which is unnecessarily prone to buggy or 
inefficient (user-)implementations.

--

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



[issue1152248] Add support for reading records with arbitrary separators to the standard IO stack

2021-02-21 Thread Christoph Anton Mitterer


Christoph Anton Mitterer  added the comment:

Just wondered whether this is still being considered?

Cheers,
Chris.

--
nosy: +calestyo

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



[issue43259] argparse: allow add_mutually_exclusive_group on add_argument_group

2021-02-21 Thread Christoph Anton Mitterer


Christoph Anton Mitterer  added the comment:

Well but if that's anyway one of its actual major use cases, wouldn't it make 
sense to properly support it?

Especially when one has a large set of identical options (which is then even 
more likely to also include mutually exclusive ones) such a feature seems to be 
pretty useful to prevent bloated code by copy large number of lines of 
identical argument parsing code.


argparse is really nice and powerful,... and enables people to make clean 
argparsing code, but it seems a few quite features which are quite often asked 
for miss, like e.g. #11354 or that one can arbitrarily group mutually exclusive 
options like:



--foo


--bar
--baz

<(mutually exclusive>


Anyway, feel free to close if you don't like supporting mutually exclusive 
groups with parents.

Cheers,
Chris.

--

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



[issue43259] argparse: allow add_mutually_exclusive_group on add_argument_group

2021-02-19 Thread Christoph Anton Mitterer


Change by Christoph Anton Mitterer :


Added file: https://bugs.python.org/file49822/test-no-parent.py

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



[issue43259] argparse: allow add_mutually_exclusive_group on add_argument_group

2021-02-19 Thread Christoph Anton Mitterer


Christoph Anton Mitterer  added the comment:

Okay the problem seems to be that I didn't give you the exact details on what I 
do.

Actually, the group (which then contains the mutually exclusive group) is 
contained in a "shared" parent parser, which I then use in the subparsers.

If I leave out the parent parser, then it works as you say.


I'll attach exact code (with which I can reproduce it).

--
Added file: https://bugs.python.org/file49821/test.py

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



[issue43259] argparse: allow add_mutually_exclusive_group on add_argument_group

2021-02-18 Thread Christoph Anton Mitterer


New submission from Christoph Anton Mitterer :

Hey.

AFAIU, the sole purpose of ArgumentParser.add_argument_group() is for the 
grouping within the help output.

It would be nice, if one could create a mutually exclusive group (with 
ArgumentParser.add_mutually_exclusive_group) from/within such a "normal" group, 
so that the mutually exclusive arguments are listed within the group, but are 
still, mutually exclusive.

Right now when doing something like:
parser = argparse.ArgumentParser()
parser_group = parser.add_argument_group("INPUT OPTIONS")
parser_group_mutually_exclusive = 
parser_group.add_mutually_exclusive_group(required=False)
parser_group_mutually_exclusive.add_argument("--from-args")
parser_group_mutually_exclusive.add_argument("--from-files")
parser_group_mutually_exclusive.add_argument("--from-stdin")
parser_group.add_argument("-0", help="null delimited pathnames")

it works, but the mutually exclusive options are note printed within the "INPUT 
OPTIONS", but rather at the normal "optional arguments:" section of the help.

The above example also kinda shows what this could be used for:
- one might have e.g. a group for input options, and amongst that the mutually 
exclusive "--from-*" which specify the source of the input.


Cheers,
Chris.

--
components: Library (Lib)
messages: 387278
nosy: calestyo
priority: normal
severity: normal
status: open
title: argparse: allow add_mutually_exclusive_group on add_argument_group
type: enhancement

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



[issue39617] max_workers argument to concurrent.futures.ProcessPoolExecutor is not flexible enough

2021-02-04 Thread Christoph Anton Mitterer


Change by Christoph Anton Mitterer :


--
nosy: +calestyo

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



[issue42742] Add abc.Mapping to dataclass

2020-12-29 Thread Anton Abrosimov


Anton Abrosimov  added the comment:

Link to python-ideas thread:
https://mail.python.org/archives/list/python-id...@python.org/thread/XNXCUJVNOOVPAPL6LF627EOCBUUUX2DG/

--

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



[issue42758] pathlib.Path to support the "in" operator (x in y)

2020-12-28 Thread Anton Hvornum


Anton Hvornum  added the comment:

Missed that function, but they would behave the same without explicitly use the 
function call.

--

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



[issue42758] pathlib.Path to support the "in" operator (x in y)

2020-12-27 Thread Anton Hvornum


New submission from Anton Hvornum :

I would like to propose that the `pathlib.Path()` gets a `in` operator, much 
like that ipaddress has IP in Subnet, it would be nice if we could be able to 
do:

```
import pathlib
pathlib.Path('/home/Torxed/machine.qcow2')
pathlib.Path('/home/Torxed/machine.qcow2') in pathlib.Path('/home/Torxed')
```

Currently that would generate:
```
Traceback (most recent call last):
  File "", line 1, in 
TypeError: argument of type 'PosixPath' is not iterable
```

This would avoid "complicated" implementations such as:
 * 
https://stackoverflow.com/questions/21411904/python-how-to-check-if-path-is-a-subpath
 * 
https://stackoverflow.com/questions/3812849/how-to-check-whether-a-directory-is-a-sub-directory-of-another-directory

Which tend to be half-complete truths and would result in potential security 
issues. pathlib.Path() could help prevent some of those.

--
components: Library (Lib)
messages: 383857
nosy: Torxed
priority: normal
severity: normal
status: open
title: pathlib.Path to support the "in" operator (x in y)
type: enhancement
versions: Python 3.10, Python 3.9

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



[issue42742] Add abc.Mapping to dataclass

2020-12-25 Thread Anton Abrosimov


Anton Abrosimov  added the comment:

Thanks for the good offer, I will definitely use it.

--

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



[issue42742] Add abc.Mapping to dataclass

2020-12-25 Thread Anton Abrosimov


Anton Abrosimov  added the comment:

This Mixin only works with dataclass objects. And uses the private 
functionality of the dataclasses. So dataclasses.py is the right place for 
this. I think I can do enough tests.

And I think that this is too little for a standalone project.

--

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



[issue42742] Add abc.Mapping to dataclass

2020-12-25 Thread Anton Abrosimov


Anton Abrosimov  added the comment:

I think the second option looks better.
More pythonic.
No need to create new classes
No typing hacks.
Mixin can be easily expanded.

Yes, I will do refactoring, typing, documentation and tests in PR.

--

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



[issue42742] Add abc.Mapping to dataclass

2020-12-25 Thread Anton Abrosimov


Anton Abrosimov  added the comment:

An alternative way:

from collections.abc import Mapping
from dataclasses import dataclass, fields, _FIELDS, _FIELD

class DataclassMappingMixin(Mapping):
def __iter__(self):
return (f.name for f in fields(self))

def __getitem__(self, key):
field = getattr(self, _FIELDS)[key]
if field._field_type is not _FIELD:
raise KeyError(f"'{key}' is not a dataclass field.")
return getattr(self, field.name)

def __len__(self):
return len(fields(self))


@dataclass
class MyDataclass(DataclassMappingMixin):
a: int = 1
b: int = 2


my_dataclass = MyDataclass(a='3')
print(my_dataclass.__class__.__mro__)
print(my_dataclass.__class__.__name__)
print(my_dataclass['a'])
print(my_dataclass['b'])
print(dict(my_dataclass))
print(dict(**my_dataclass))
print(fields(my_dataclass))


Result:
(,
 ,
 ,
 ,
 ,
 ,
 ,
 )
MyDataclass
3
2
{'a': '3', 'b': 2}
{'a': '3', 'b': 2}
(Field(name='a',type=, ...),
 Field(name='b',type=, ...))

--

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



[issue42742] Add abc.Mapping to dataclass

2020-12-25 Thread Anton Abrosimov


Anton Abrosimov  added the comment:

Thanks for the answer, I agree.
The implementation should be like this?


from collections.abc import Mapping
from dataclasses import dataclass, fields, _FIELDS, _FIELD

class _DataclassMappingMixin(Mapping):
def __iter__(self):
return (f.name for f in fields(self))

def __getitem__(self, key):
fields = getattr(self, _FIELDS)
f = fields[key]
if f._field_type is not _FIELD:
raise KeyError(f"'{key}' is not a dataclass field.")
return getattr(self, f.name)

def __len__(self):
return len(fields(self))


def dataclass_mapping(cls=None, **kwargs):
def apply_dataclass(cls):
dataclass_wrap = dataclass(**kwargs)
return dataclass_wrap(cls)

def check_mapping_attrs(cls):
mapping_attrs = (i for i in dir(_DataclassMappingMixin) if i[0] != '_')
for key in mapping_attrs:
if hasattr(cls, key):
raise AttributeError(f"'{key}' is the Mapping reserved 
attribute.")

def apply_mapping(cls):
return type(cls.__name__ + 'Mapping',
(cls, _DataclassMappingMixin),
{})

def wrap(cls):
check_mapping_attrs(cls)
cls_dataclass = apply_dataclass(cls)
return apply_mapping(cls_dataclass)

# See if we're being called as @dataclass or @dataclass().
if cls is None:
# We're called with parens.
return wrap

# We're called as @dataclass without parens.
return wrap(cls)


@dataclass_mapping
class MyDataclass:
a: int = 1
b: int = 2


my_dataclass = MyDataclass(b='3')
print(my_dataclass.__class__.__name__)
print(my_dataclass['a'])
print(my_dataclass['b'])
print(dict(my_dataclass))
print(dict(**my_dataclass))

--

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



[issue42742] Add abc.Mapping to dataclass

2020-12-25 Thread Anton Abrosimov


New submission from Anton Abrosimov :

I want to add `abc.Mapping` extension to `dataclasses.dataclass`.

Motivation:

1. `asdict` makes a deep copy of the `dataclass` object. If I only want to 
iterate over the `field` attributes, I don't want to do a deep copy.
2. `dict(my_dataclass)` can be used as a `dict` representation of 
`my_dataclass` class without deep copying.
3. `myfunc(**my_dataclass)` looks better and is faster then 
`myfunc(**asdict(my_dataclass))`.
4. `len(my_dataclass) == len(asdict(my_dataclass))` is expected behavior.
5. `my_dataclass.my_field is my_dataclass['my_field']` is expected behavior.


Looks like a prototype:

from collections.abc import Mapping
from dataclasses import dataclass, fields, _FIELDS, _FIELD


@dataclass  # `(mapping=True)` creates such a class:
class MyDataclass(Mapping):
a: int = 1
b: int = 2

# In `dataclasses._process_class`:
# if `mapping` is `True`.
# Make sure 'get', 'items', 'keys', 'values' is not in `MyDataclass` fields.

def __iter__(self):
return (f.name for f in fields(self))

def __getitem__(self, key):
fields = getattr(self, _FIELDS)
f = fields[key]
if f._field_type is not _FIELD:
raise KeyError(f"'{key}' is not a field of the dataclass.")
return getattr(self, f.name)

def __len__(self):
return len(fields(self))


my_dataclass = MyDataclass(b=3)
print(my_dataclass['a'])
print(my_dataclass['b'])
print(dict(my_dataclass))
print(dict(**my_dataclass))

Stdout:
1
3
{'a': 1, 'b': 3}
{'a': 1, 'b': 3}


Realisation:

Updating the `dataclasses.py`: `dataclass`, `_process_class`, 
`_DataclassParams`.
Set `mapping` argument to default `False`.


Can this enhancement be accepted?

--
components: Library (Lib)
messages: 383752
nosy: abrosimov.a.a
priority: normal
severity: normal
status: open
title: Add abc.Mapping to dataclass
type: enhancement
versions: Python 3.10

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



[issue29447] Add/check os.PathLike support for the tempfile module's 'dir' arguments

2020-07-17 Thread Christoph Anton Mitterer


Change by Christoph Anton Mitterer :


--
nosy: +calestyo

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



[issue11354] argparse: nargs could accept range of options count

2020-07-09 Thread Christoph Anton Mitterer


Christoph Anton Mitterer  added the comment:

Next to code readability, there's IMO one could reason to properly support this 
would be a clean and easy way to get proper help strings for such options.

Of course I can do something like:
parser = argparse.ArgumentParser()
parser.add_argument("--foo", nargs="+", help="Mae govannen", metavar=("bar", 
"baz"))
args = parser.parse_args()

and later check that, say, only 2 arguments are allowed.

But the help text will be an ugly:
>$ python3 f.py --help
>usage: f.py [-h] [--foo bar [baz ...]]
>
>optional arguments:
>  -h, --help   show this help message and exit
>  --foo bar [baz ...]  Mae govannen

indicating that >1 options were allowed.

--
nosy: +calestyo

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



[issue36439] Inconsistencies with datetime.fromtimestamp(t) when t < 0

2020-06-10 Thread Paul Anton Letnes


Paul Anton Letnes  added the comment:

I've encountered an issue on anaconda python on windows 10 v1909 which I 
suspect is related. It looks like no dates in 1970 can be converted to 
datetime.timestamp():

Python 3.8.2 (default, Apr 14 2020, 19:01:40) [MSC v.1916 64 bit (AMD64)]
Type 'copyright', 'credits' or 'license' for more information
IPython 7.13.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import datetime

In [2]: datetime.datetime(1970, 1, 2, 0, 0, 1, 123456).timestamp()
---
OSError   Traceback (most recent call last)
 in 
> 1 datetime.datetime(1970, 1, 2, 0, 0, 1, 123456).timestamp()

OSError: [Errno 22] Invalid argument

In [3]: datetime.datetime(1971, 1, 2, 0, 0, 1, 123456).timestamp()
Out[3]: 31618801.123456

--
nosy: +Paul Anton Letnes

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



[issue16487] Allow ssl certificates to be specified from memory rather than files.

2020-02-26 Thread Lord Anton Hvornum


Lord Anton Hvornum  added the comment:

I agree with Jan-Philip Gehrcke, would have been nice to have had this.

Pretty pissed reading through this ancient issue.

In regards to how people treat other volunteers: We're all working for free, 
and I think expectations from people with authoritative powers must have room 
for accepting a initially lower contribution standard than they themselves 
claim to produce. Mainly to not crush the will to help and contibute, but also 
because the attitude could be a lot better towards fellow programmers. It would 
also allow for a more iterative process in achieving higher standards. 
Otherwise you limit yourself to a very select few in the contribution process. 
Not to mention a lot of "grunt work" could be done by people having an idea, 
but not nessecarily the same "academic background" in terms of producing 
perfect code.

I've seen this across numerous Open Source projects, and quite frankly it deter 
me from ever contributing. PoC code shouldn't be seen as garbage, but a first 
step in creating new fresh things. Someone with more knowledge should and could 
step in and clean up things that are deamed "unfit" for production or help said 
contributor to understanding why certain things needs to be improved, not just 
blatently say patches needs to be improved.

This whole "It ain't perfect, we don't touch it" is elitism at it's finest. 
Stop it, and have a meaningful discussion instead.

--
nosy: +Lord Anton Hvornum

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



[issue39100] email.policy.SMTP throws AttributeError on invalid header

2019-12-19 Thread Anton Khirnov


New submission from Anton Khirnov :

When parsing a (broken) mail from linux-me...@vger.kernel.org (message-id 
20190212181908.horde.peighvv2khy9ekuy8ta8...@webmail.your-server.de, headers 
attached) with email.policy.SMTP, I get an AttributeError on trying to read the 
'to' header:

/usr/lib/python3.7/email/headerregistry.py in (.0)
345  mb.local_part or '',
346  mb.domain or '')
--> 347  for mb in addr.all_mailboxes]))
348 defects = list(address_list.all_defects)
349 else:

AttributeError: 'Group' object has no attribute 'local_part'

The header in question is:
To: unlisted-recipients:; (no To-header on input)

The problem seems to be that mb is a Group and not an Address, gets token_type 
of 'invalid-mailbox', but does not have the attributes local_part/domain that 
are expected in mailboxes. Copying the line

local_part = domain = route = addr_spec = display_name

from InvalidMailbox to Group fixes this, but it is not clear to me this is the 
right solution, so not sending a patch.

--
components: email
files: mail.eml
messages: 358689
nosy: barry, elenril, r.david.murray
priority: normal
severity: normal
status: open
title: email.policy.SMTP throws AttributeError on invalid header
type: behavior
Added file: https://bugs.python.org/file48792/mail.eml

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



[issue38825] shutil.disk_usage - Lacking documentation

2019-11-17 Thread Lord Anton Hvornum


Lord Anton Hvornum  added the comment:

xtreak: You are correct, that was a typo. My apologies.

--

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



[issue38825] psutil.disk_usage - Lacking documentation

2019-11-16 Thread Lord Anton Hvornum


New submission from Lord Anton Hvornum :

https://docs.python.org/3.8/library/shutil.html#shutil.disk_usage

There's no mention that this helper function simply calls `os.statvfs()` in the 
background. Something that is quite troubling when you're trying to get 
disk_usage (or disk-information) about a non-mounted drive.

It's clear as day if you see the code: 
https://github.com/python/cpython/blob/master/Lib/shutil.py#L1249

But if you're a novice user, this will puzzle your brain.
Because the end result will be that `disk_usage()` returns the same information 
for all these cases:

shutil.disk_usage('/dev/sda')
shutil.disk_usage('/dev/sdb')
shutil.disk_usage('/dev/sdc')

Which translates to:

os.statvfs('/dev/sd?')'

--

All I'm asking, is that we add a little note stating:
"On *mounted* filesystems" or a reference to `os.statvfs()` where it's clearly 
stated that it runs on mounted filesystems.

Thanks in advance.

--
assignee: docs@python
components: Documentation
messages: 356771
nosy: Lord Anton Hvornum, docs@python
priority: normal
severity: normal
status: open
title: psutil.disk_usage - Lacking documentation
type: enhancement
versions: Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 3.9

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



[issue38817] Immutable types inplace operations work incorrect in async

2019-11-15 Thread Anton Bryzgalov


Anton Bryzgalov  added the comment:

Example code (also is attached to the issue):


import asyncio

async def count_smth(seconds: int) -> int:
await asyncio.sleep(seconds)
return seconds * 3

async def small_job(d: dict, key: str, seconds: int) -> None:
d[key] += await count_smth(seconds)  # <-- strange happens here

async def main() -> None:
 d = dict(key=0)
 await asyncio.gather(
   small_job(d, 'key', 1),
   small_job(d, 'key', 2),
 )
 print(d['key'])  # expected: 0 + 1 * 3 + 2 * 3 = 9, actual: 6

if __name__ == '__main__':
asyncio.run(main())


Expected output: 0 + 1 * 3 + 2 * 3 = 9. Actual: 6. Seems to be a race condition.

Same happens for other immutable types: str, tuple (when used as values of dict 
instead of int). But works correctly with list and custom class with __iadd__ 
method.

Same effect for treading version (output is the same):


import time
import threading

def count_smth(seconds: int) -> int:
time.sleep(seconds)
return seconds * 3

def small_job(d: dict, key: str, seconds: int) -> None:
d[key] += count_smth(seconds)  # <-- strange happens here

def main() -> None:
d = dict(key=0)
t1 = threading.Thread(target=small_job, args=(d, 'key', 1))
t2 = threading.Thread(target=small_job, args=(d, 'key', 2))
t1.start()
t2.start()
t1.join()
t2.join()
print(d['key'])  # expected: 0 + 1 * 3 + 2 * 3 = 9, actual: 6

main()


Inplace operation is expected to occur only at the time when the second operand 
is evaluated.

--
Added file: https://bugs.python.org/file48718/inplace_bug_threading.py

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



[issue38734] Python 3.7 and 3.8 in Windows Store do not start under git bash

2019-11-07 Thread Paul Anton Letnes


New submission from Paul Anton Letnes :

Python 3.7 and 3.8 installed from the  Windows Store do not start under git 
bash. Rather, they give some variation of this error message:

bash: /c/Users/pa/AppData/Local/Microsoft/WindowsApps/python: Permission denied

However, the permissions are rwxr-xr-x, or 755 if you prefer. The same error 
occurs if I try to run pip.

How can I run python under git bash? I use python and various pip-installed 
executables (e.g. black) for git hooks, so this has to work for my workflow.

--
components: Windows
messages: 356183
nosy: paul.moore, pletnes, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Python 3.7 and 3.8 in Windows Store do not start under git bash
type: crash
versions: Python 3.7, Python 3.8

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



How to find files with a string

2019-01-09 Thread anton . gridushko
Hello everyone!

I need to find a file, that contains a string TeNum

I try to 

import os
import sys
def find_value(fname):
value = 0
with open(fname, encoding='cp866') as fn:
try:
for i in fn:
if 'TeNam' in i:
print(fname)
except IndexError:
pass
return {fname}
def main():
dirname = ('H:\\1\\3')
os.chdir(dirname)
res = {}
for i in os.listdir(dirname):
res.update(find_value(i))
print('Filename is: ')
if __name__ == "__main__":
main()

But there are mistakes like
C:\Users\Anton\AppData\Local\Programs\Python\Python36-32\python.exe 
"C:/Users/Anton/PycharmProjects/Работа с файловой системой/Перебор файлов из 
папки.py"
Traceback (most recent call last):
  File "C:/Users/Anton/PycharmProjects/Работа с файловой системой/Перебор 
файлов из папки.py", line 21, in 
    main()
  File "C:/Users/Anton/PycharmProjects/Работа с файловой системой/Перебор 
файлов из папки.py", line 18, in main
res.update(find_value(i))
ValueError: dictionary update sequence element #0 has length 35; 2 is required

Process finished with exit code 1

Could you help me to solve this thread?
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue34965] Python on Docker container using flask is going down after sometime

2018-10-12 Thread Anton Barkovsky


Anton Barkovsky  added the comment:

Do you have any evidence to believe that this is caused by a bug in CPython 
itself or its stdlib? If not, it's probably an issue with your code, libraries, 
or environment, and so out of scope in this tracker.

--
nosy: +anton.barkovsky

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



[issue34961] Global scoping when shadowing local names in class definitions

2018-10-12 Thread Anton Barkovsky


Change by Anton Barkovsky :


--
nosy: +anton.barkovsky

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



[issue23794] http package should support HTTP/2

2018-10-12 Thread Anton Barkovsky


Change by Anton Barkovsky :


--
nosy: +anton.barkovsky

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



[issue27261] io.BytesIO.truncate does not work as advertised

2018-10-12 Thread Anton Barkovsky


Anton Barkovsky  added the comment:

I'm willing to try to fix this behavior.

I just want to check that this would not be considered breaking backwards 
compatibility. I can imagine in theory some code relying on it, but I would say 
that it would be relying on a bug. If some code is passed BytesIO in place of a 
file, then the current behavior is clearly undesirable. If some code 
specifically uses BytesIO and relies on this... I guess this can happen, but 
should be very rare and contrary to widely documented behavior. So it seems ok 
to just fix this, but I'm not very familiar with how such changes are usually 
handled in cPython, so I'd like to get approval from someone experienced.

--

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



[issue27261] io.BytesIO.truncate does not work as advertised

2018-10-12 Thread Anton Barkovsky


Change by Anton Barkovsky :


--
nosy: +anton.barkovsky

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



[issue34256] Python treats ASCII record seperator ('\x1e') as a newline

2018-07-28 Thread Anton Patrushev


Anton Patrushev  added the comment:

0x1e listed as linebreak char in tests:

Lib/test/test_unicodedata.py:317

--
nosy: +apatrushev

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



[issue34137] Add Path.lexist() to pathlib

2018-07-26 Thread Anton Patrushev


Change by Anton Patrushev :


--
nosy: +apatrushev

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



[issue27794] setattr a read-only property; the AttributeError should show the attribute that failed

2018-07-26 Thread Anton Patrushev


Change by Anton Patrushev :


--
nosy: +apatrushev

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



[issue32395] asyncio.StreamReader.readuntil is not general enough

2018-07-26 Thread Anton Patrushev


Change by Anton Patrushev :


--
nosy: +socketpair

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



[issue33678] selector_events.BaseSelectorEventLoop.sock_connect should preserve socket type

2018-07-26 Thread Anton Patrushev


Anton Patrushev  added the comment:

I created small script showing the error.

--
nosy: +apatrushev
versions: +Python 3.7
Added file: https://bugs.python.org/file47714/test.py

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



[issue31830] asyncio.create_subprocess_exec doesn't capture all stdout output

2018-07-26 Thread Anton Patrushev


New submission from Anton Patrushev :

The issue is invalid. I just added the following lines to the end of your main:
```
line = await asyncio.wait_for(process.stderr.readline(), 10)
print(line)
```

and got additional info:
```
b'/bin/bash: echo local: command not found\n'
```

So the problem is not in asyncio.

--
nosy: +apatrushev

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



[issue33837] Closing asyncio.Server on asyncio.ProactorEventLoop causes all active servers to stop listening

2018-07-26 Thread Anton Patrushev


Anton Patrushev  added the comment:

This issue was fixed in:
git319c0345cdd8fddb49d235462e71883f1dd51b99

--
nosy: +apatrushev

___
Python tracker 
<https://bugs.python.org/issue33837>
___
___
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-07-25 Thread Anton Patrushev


Anton Patrushev  added the comment:

The same problem is reproducible with different but obvious way on Python 2.7.

--
versions: +Python 2.7

___
Python tracker 
<https://bugs.python.org/issue33193>
___
___
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-07-25 Thread Anton Patrushev


Anton Patrushev  added the comment:

I found when this "feature" was implemented:
gitff2d9b71547d95566416fa968872910ca9c4adb1

Part of commit message:
```
in command-line options, and in two phases at that: first, we expand
'install_base' and 'install_platbase', and then the other 'install_*'
options.  This lets us do tricky stuff like
install --prefix='/tmp$sys_prefix'
...oooh, neat.
```

So this was intentional change in distutils.

The only suggestion I have to fix this issue without break something in the 
wild is to suppress exception in Lib/distutils/util.py:189 and leave variable 
without available substitutions as it is. To be on safe side this can be even 
optional and disabled by default.

I am newcomer so some guidance will be helpful.

--
nosy: +Anton Patrushev

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



pip problems

2018-04-08 Thread Anton Alley
(I am on Windows 10) When I install a new Python version, pip does not
update all of the way. In the command line 'pip' still runs the old
pip.exe, so I've had to manually move the new pip to C:\Windows .


It would be great if you fixed this for future python versions!


Thanks,
Anton
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue31597] ipaddress.hosts() doesn't return anything on a /32 "network"

2017-09-26 Thread Lord Anton Hvornum

Lord Anton Hvornum added the comment:

Historically Windows have struggled with /32 assigned networks.
Trying to push such a network address to a Windows machine has usually (not
all cases) rendered it connection-less, where as switches, routers, *nix
etc have never had any major issues with the logic of a /32 network host
isolation.

Anyway, it was a slight joke/peck on the history of networking.

On Tue, Sep 26, 2017 at 10:53 PM Eric V. Smith <rep...@bugs.python.org>
wrote:

>
> Eric V. Smith added the comment:
>
> You lost me at "some Windows mentality". I come from a networking
> background.
>
> Sorry, I don't care enough about this issue to pursue it.
>
> --
>
> ___
> Python tracker <rep...@bugs.python.org>
> <https://bugs.python.org/issue31597>
> ___
>

--

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



[issue31597] ipaddress.hosts() doesn't return anything on a /32 "network"

2017-09-26 Thread Lord Anton Hvornum

Lord Anton Hvornum added the comment:

I was actually just thinking about the same thing, why not just add a
optional flag to the already existing function.
I get that people are way into backward compatibility, and I won't get into
a religious fight over that particular topic as long as there's a fix for
this honestly strange behavior. (It's some Windows mentality saying a /32
network doesn't contain any hosts when you come from a network background).

Seeing as this is apparently a touchy subject, I won't even try to submit a
patch for this because I will screw this up.
So I politely ask someone with more intricate knowledge of this library,
it's history and use to add a totally optional flag that returns the single
host on this very narrow network called /32.

On Tue, Sep 26, 2017 at 10:33 PM Eric V. Smith <rep...@bugs.python.org>
wrote:

>
> Eric V. Smith added the comment:
>
> Yes, due to backward compatibility constraints, the behavior is immutable.
>
> You might be able to argue for another method, say all_hosts(), or
> something. Or maybe even a optional parameter to hosts() that defaults to
> the existing behavior, but if provided, lets you select a new behavior.
>
> What I would not support is a change to hosts() (or a new method) that
> treats a /32 network specially.
>
> --
> nosy: +eric.smith
>
> ___
> Python tracker <rep...@bugs.python.org>
> <https://bugs.python.org/issue31597>
> ___
>

--

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



[issue31597] ipaddress.hosts() doesn't return anything on a /32 "network"

2017-09-26 Thread Lord Anton Hvornum

Lord Anton Hvornum added the comment:

And this definition is some how immutable?

On Tue, Sep 26, 2017 at 10:19 PM Serhiy Storchaka <rep...@bugs.python.org>
wrote:

>
> Serhiy Storchaka added the comment:
>
> Because this is a definition of this method.
>
> --
>
> ___
> Python tracker <rep...@bugs.python.org>
> <https://bugs.python.org/issue31597>
> ___
>

--

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



[issue31597] ipaddress.hosts() doesn't return anything on a /32 "network"

2017-09-26 Thread Lord Anton Hvornum

Lord Anton Hvornum added the comment:

This is still a very strange behavior and I can't see why this still
shouldn't return a IP address.
if the broadcast, network and host address are all the same, that should
call for a exceptional behavior from the library.
Because 127.0.0.1/32 is still a usable host address, and it's a way of
isolating a host on a network device for instance, but it's still a host
address in there.. Or am i loosing my marbles?

On Tue, Sep 26, 2017 at 10:08 PM Serhiy Storchaka <rep...@bugs.python.org>
wrote:

>
> Serhiy Storchaka added the comment:
>
> This is documented.
>
>  hosts()
>
> Returns an iterator over the usable hosts in the network. The usable
> hosts are all the IP addresses that belong to the network, except the
> network address itself and the network broadcast address.
>
> >>> import ipaddress
> >>> ipaddress.ip_network('127.0.0.1/32').network_address
> IPv4Address('127.0.0.1')
> >>> ipaddress.ip_network('127.0.0.1/32').broadcast_address
> IPv4Address('127.0.0.1')
>
> --
> nosy: +serhiy.storchaka
> resolution:  -> not a bug
> stage:  -> resolved
> status: open -> closed
>
> ___
> Python tracker <rep...@bugs.python.org>
> <https://bugs.python.org/issue31597>
> ___
>

--

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



[issue31597] ipaddress.hosts() doesn't return anything on a /32 "network"

2017-09-26 Thread Lord Anton Hvornum

New submission from Lord Anton Hvornum:

https://docs.python.org/3/library/ipaddress.html#ipaddress.IPv4Network.hosts

I couldn't find anywhere in the documentation mentioning the fact that doing 
the following would return nothing:

>>> import ipaddress
>>> net = ipaddress.ip_network('127.0.0.1/32')
>>> list(net.hosts())
[]

For all intense and purposes, that network still contains hosts.
That being one single lonely host of '127.0.0.1'.

It's illogical to not return any hosts if there actually are one or more in 
there.
Now the programmer has to do a one-off-check to see if this particular defined 
network (of a huge list usually)
happens to end with /32, then it needs to treat the item not as a defined 
network (even tho it is with a netmask),
but rather strip the netmask and treat it as a single host entity.. It makes no 
sense if you're iterating over a huge list of network infrastructure.

--
components: Library (Lib)
messages: 303063
nosy: Lord Anton Hvornum
priority: normal
severity: normal
status: open
title: ipaddress.hosts() doesn't return anything on a /32 "network"
type: behavior
versions: Python 3.6, Python 3.7, Python 3.8

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



[issue30820] email.contentmanager.raw_data_manager fails to create multipart messages

2017-06-30 Thread Anton Khirnov

New submission from Anton Khirnov:

The documentation for the "new API" -- email.contentmanager.raw_data_manager -- 
claims that passing a list of messages to set_content() will create a multipart 
message. However, it fails with "KeyError: 'builtins.list'" and from looking at 
the code it seems this functionality is not and never was implemented.

--
components: email
messages: 297430
nosy: barry, elenril, r.david.murray
priority: normal
severity: normal
status: open
title: email.contentmanager.raw_data_manager fails to create multipart messages
type: behavior
versions: Python 3.5, Python 3.6

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



[issue29860] smtplib.py doesn't capitalize EHLO.

2017-03-20 Thread Lord Anton Hvornum

Lord Anton Hvornum added the comment:

Seeing as I'm the one who built the server, it sure is out of spec :)

I could also quickly correct for this "issue" server-side.
So this is more of a "style guideline" change client-side - If no one opposes 
of keeping commands stylistically the same.

--

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



[issue29860] smtplib.py doesn't capitalize EHLO.

2017-03-20 Thread Lord Anton Hvornum

Lord Anton Hvornum added the comment:

Turns out, this goes for a lot more commands, such as:

```
Traceback (most recent call last):
  File "mail.py", line 12, in 
smtp_server.sendmail(fromaddr, toaddrs, msg)
  File "/usr/lib/python3.6/smtplib.py", line 866, in sendmail
raise SMTPSenderRefused(code, resp, from_addr)
```

The command that the server refused was:

mail FROM:<my_m...@gmail.com> size=11

Again, this is mostly because traditionally server commands are upper case 
(even tho RFC 821 defines that they can be any syntax, such as `mAiL FroM`).

But it would be nice if Python could keep consistency in it's syntax IMHO.

--

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



[issue29860] smtplib.py doesn't capitalize EHLO.

2017-03-20 Thread Lord Anton Hvornum

New submission from Lord Anton Hvornum:

```
  File "mail.py", line 9, in 
smtp_server.starttls(context)
  File "/usr/lib/python3.6/smtplib.py", line 748, in starttls
self.ehlo_or_helo_if_needed()
  File "/usr/lib/python3.6/smtplib.py", line 600, in ehlo_or_helo_if_needed
(code, resp) = self.helo()
  File "/usr/lib/python3.6/smtplib.py", line 429, in helo
(code, msg) = self.getreply()
  File "/usr/lib/python3.6/smtplib.py", line 393, in getreply
raise SMTPServerDisconnected("Connection unexpectedly closed")
```

This happens due to the server expecting commands (like EHLO, STARTTLS) being 
strict upper-case. And when the SMTP command isn't, it drops us.

This is a rare edge case since most mail servers handles shady client data in 
numerous different ways (such as gmail never sending QUIT for instance).

I don't know of a work-around for this and the documentation states `EHLO` is 
being sent (https://docs.python.org/3/library/smtplib.html), so I guess the lib 
assumes that's the case as well.

--
components: Library (Lib)
messages: 289886
nosy: Lord Anton Hvornum
priority: normal
severity: normal
status: open
title: smtplib.py doesn't capitalize EHLO.
versions: Python 3.6, Python 3.7

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



[issue29858] inspect.signature includes bound argument for wrappers around decorated bound methods

2017-03-20 Thread anton-ryzhov

Changes by anton-ryzhov <an...@ryzhov.me>:


--
pull_requests: +650

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



[issue29858] inspect.signature includes bound argument for wrappers around decorated bound methods

2017-03-20 Thread anton-ryzhov

anton-ryzhov added the comment:

Related to http://bugs.python.org/issue24298

--

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



[issue29858] inspect.signature includes bound argument for wrappers around decorated bound methods

2017-03-20 Thread anton-ryzhov

New submission from anton-ryzhov:

If we wrap function with bound method, which is also a wrapper around function, 
`inspect.signature` will not do `skip_bound_arg`.
It will use `inspect.unwrap` and pass by bound method from outer function to 
inner one.

Reproduce:
```
import functools, inspect


def decorator(func):
@functools.wraps(func)
def inner(*args):
return func(*args)
return inner


class Foo(object):
@decorator
def bar(self, testarg):
pass


f = Foo()
baz = decorator(f.bar)
assert inspect.signature(baz) == inspect.signature(f.bar)
```

--
components: Library (Lib)
messages: 289879
nosy: anton-ryzhov
priority: normal
severity: normal
status: open
title: inspect.signature includes bound argument for wrappers around decorated 
bound methods
versions: Python 3.3, Python 3.4, Python 3.5, Python 3.6, Python 3.7

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




Re: MacOSX SpeechRecognition installation problems

2016-12-08 Thread Anton Mamaenko
I would suggest using virtual environment (virtualenv, for example) for 
installing such packages. 

Dealing with directory permissions on MacOS is complicated, and using "sudo" is 
not the right way. Moreover, during the next OS upgrade the permissions will be 
updated as well, and chances are that your global package configuration breaks 
anyways. 

Regards,
  Anton

>> On 8 Dec 2016, at 09:18, Michael Torrie <torr...@gmail.com> wrote:
>> 
>> On 12/07/2016 11:09 PM, 3dB wrote:
>> trying to install SpeechRecognition for Python results in error:
>> 
>> running install_lib
>>   creating /Library/Python/2.7/site-packages/speech_recognition
>>   error: could not create 
>> '/Library/Python/2.7/site-packages/speech_recognition': Permission denied
>> 
>> 
>> Any advice on how to fix?
> 
> Are you using sudo?
> 
>> 
>> Follow information may be helpful:
>> 
>> MacOSX 10.12.1
>> Python 2.7.10 (default, Jul 30 2016, 18:31:42) 
>> [GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.34)] on darwin
>> 
>> /usr/local/bin/brew
>> /usr/bin/python
>> 
>> pip 9.0.1 from /Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg (python 
>> 2.7)
> 
> -- 
> https://mail.python.org/mailman/listinfo/python-list
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-07 Thread Anton Mamaenko
Wow... this thread gets to finally become a holy war.  One method is dealing 
with this is take the environment as granted (Windows/Unix/Linux/MacOS/Dos 
sucks while my 
Windows/Unix/Linux/MacOS/Dos is the best) and figure if the hassle of porting 
(time, tech, AND moral) worth it. He just "do not try. Do or not do."

So stop complaining. Just live with it. 

Regards,
   Anton

> On 7 Dec 2016, at 21:02, BartC <b...@freeuk.com> wrote:
> 
>> On 07/12/2016 16:53, Michael Torrie wrote:
>>> On 12/07/2016 08:48 AM, BartC wrote:
>>> I would prefer that the program "t" can be invoked exactly the same way
>>> under both systems. I don't want different instructions for Linux, or
>>> for the user (of my language) to have to write two lots of code, as that
>>> is my job...
>> 
>> Ahh now we come to the crux of your argument.  You want all potential
>> platforms to conform to your own idea of what is normal.  And indeed
>> this is the actual issue that started the original thread.  But that's
>> not the way it works for any platform.  I develop a lot of code on Linux
>> that I'd like to get running on Windows.  I prefer the Linux way of
>> doing things but I'm not going to make any headway if I just try to
>> brow-beat Windows and Windows' users over the things that aren't
>> implement the same way.
> 
> There is a lack of balance.
> 
> If I run a Linux program on Windows, then the application gets to see 
> parameters such as *.* and can expand them if it wants.
> 
> If I want to run a Windows program on Linux, and that program needs to see 
> *.* unexpanded, then it can't undo that expansion. The cat is already out of 
> the bag.
> 
> It seems the only choice, if someone wants a cross-platform application that 
> is invoked in the same way, is to dumb it down and make it assume that any 
> parameters such as A* have been expanded, or will be expanded by that extra 
> step.
> 
> Which means that input of A B* *C will all end up running together so that 
> you have no idea what is what or which file corresponds to which expansion. 
> That's assuming these parameters have any connection to the current set of 
> files at all; if not, then the input you end up is going to be meaningless.
> 
> Now the problem is to determine whether processed input of U V W X Y Z are 
> intended bona fide inputs, or whether they just happened to result from some 
> random associations with the files in the current directory.
> 
> But this is what happens when you have to work to the lowest common 
> denominator. The only proper solution is ban any unescaped ? or * from 
> inputs, and to add a warning that the program could behave unexpectedly if 
> they are used inadvertently.
> 
> (I'm in the middle of porting my console editor to Linux. But one problem is 
> that on one Linux, half the key combinations (eg. Shift+Ctrl+B) are not 
> recognised. On other Linux, nearly all of those are missing too, plus most of 
> the rest! Which means I have to adapt the editor, again, to the lowest common 
> denominator, the minimum set of keys that are guaranteed to work on both.
> 
> Except that was only two Linuxes; perhaps on others, the keyboard will likely 
> be crippled in some other way. That is, the same universal USB keyboard that 
> you can buy anywhere for $5 or $10, which has keys marked Shift, Ctrl and 
> Alt, but whose combinations cannot be recognised consistently.
> 
> How people manage to do anything on such an OS I've no idea. Or maybe they 
> spend all day just typing elaborate file-matching patterns to pipe between 
> applications.)
> 
> -- 
> Bartc
> -- 
> https://mail.python.org/mailman/listinfo/python-list
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: When will they fix Python _dbm?

2016-12-05 Thread Anton Mamaenko
What is your operating system, environment, and Python build? 

dbm is just a module that might not have been included into your Python build. 
It's not a bug but a deliberate choice of the package maker. 

Regards,
   Anton

> On 5 Dec 2016, at 17:45, clvanwall <clvanw...@gmail.com> wrote:
> 
> I have been a Perl programmer for 15+ years and decided to give Python a try. 
>  My platform is windows and I installed the latest 3.5.2. Next I decided to 
> convert a perl program that uses a ndbm database since according to the doc 
> on python, it should be able to work with it.  Needless to say, I get: 
> dbm.error: db type is dbm.ndbm, but the module is not available
> Searching on Python Bug Tracker shows _dbm missing back in 03-03-2012!  
> That's a long time for a bug to be left open.  
> John Van Walleghen
> 
> 
> Sent from my Galaxy Tab® A
> -- 
> https://mail.python.org/mailman/listinfo/python-list
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: What exactly is a python variable?

2016-11-17 Thread Anton Mamaenko
Just a couple of days ago I was asking myself a similar question, and found 
this blog article: 
https://jeffknupp.com/blog/2013/02/14/drastically-improve-your-python-understanding-pythons-execution-model/

Clarified a lot of things to me. 

, Anton

> On 17 Nov 2016, at 16:19, BartC <b...@freeuk.com> wrote:
> 
>> On 17/11/2016 12:20, Steve D'Aprano wrote:
>> On Thu, 17 Nov 2016 10:37 pm, BartC wrote:
> 
>>> (I don't know how to disassemble code outside a function, not from
>>> inside the same program. Outside it might be: 'python -m dis file.py')
> 
>> In the most recent versions of Python, dis.dis() will also accept a string:
>> 
>> py> dis.dis('y = x + 1')
>>  1   0 LOAD_NAME0 (x)
>>  3 LOAD_CONST   0 (1)
>>  6 BINARY_ADD
>>  7 STORE_NAME   1 (y)
>> 10 LOAD_CONST   1 (None)
>> 13 RETURN_VALUE
> 
> 
> Py2 gave me (for "y=x+1"):
> 
>  0 SETUP_EXCEPT30781 (to 30784)
>  3 STORE_SLICE+3
>  4 <49>
> 
> Py3.4 works as you say but after that result I was disinclined to take it 
> further!
> 
> -- 
> Bartc
> -- 
> https://mail.python.org/mailman/listinfo/python-list
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue28414] SSL match_hostname fails for internationalized domain names

2016-10-12 Thread Anton Sychugov

Anton Sychugov added the comment:

Christian, thanks a lot for your comment and for patch you provide. It becomes 
much clearer.
I'll be watching for #17305.

--

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



[issue28414] SSL match_hostname fails for internationalized domain names

2016-10-11 Thread Anton Sychugov

Anton Sychugov added the comment:

Yes, I misspelled, match_hostname() fails with ssl.CertificateError.

--

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



[issue28414] SSL match_hostname fails for internationalized domain names

2016-10-11 Thread Anton Sychugov

Changes by Anton Sychugov <abracada...@gmail.com>:


--
assignee:  -> christian.heimes
components: +SSL
nosy: +christian.heimes

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



[issue28414] SSL match_hostname fails for internationalized domain names

2016-10-11 Thread Anton Sychugov

Changes by Anton Sychugov <abracada...@gmail.com>:


--
type:  -> enhancement

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



[issue28414] SSL match_hostname fails for internationalized domain names

2016-10-11 Thread Anton Sychugov

New submission from Anton Sychugov:

In accordance with http://tools.ietf.org/html/rfc6125#section-6.4.2:
"If the DNS domain name portion of a reference identifier is an 
internationalized domain name, then an implementation MUST convert any U-labels 
[IDNA-DEFS] in the domain name to A-labels before checking the domain name."
The question is: Where in python stdlib should it to convert domain name from 
U-label to A-label? Should it be in ssl._dnsname_match, e.g.:
...
hostname = hostname.encode('idna').decode('utf-8')
...
Or should it be at ssl._dnsname_match caller level?

I found that error appears after using ssl.SSLContext.wrap_bio, which in turn 
uses internal newPySSLSocket, which in turn always decode server_hostname 
through:
PySSLSocket *self;
...
PyObject *hostname = PyUnicode_Decode(server_hostname, strlen(server_hostname), 
"idna", "strict");
...
self->server_hostname = hostname;
In this way, SSLSocket always contains U-label in its server_hostname field, 
and ssl._dnsname_match falis with "ssl.CertificateError: hostname ... doesn't 
match either of ..."

And i don't understand where is a bug, or is it a bug.

--
components: asyncio
messages: 278466
nosy: abracadaber, gvanrossum, yselivanov
priority: normal
severity: normal
status: open
title: SSL match_hostname fails for internationalized domain names
versions: Python 3.4, Python 3.5

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



[issue27639] UserList.__getitem__ doesn't account for slices

2016-07-28 Thread Anton Backer

Changes by Anton Backer <ole...@gmail.com>:


Removed file: http://bugs.python.org/file43924/581663cb2d4d.diff

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



[issue27639] UserList.__getitem__ doesn't account for slices

2016-07-28 Thread Anton Backer

Changes by Anton Backer <ole...@gmail.com>:


--
keywords: +patch
Added file: http://bugs.python.org/file43924/581663cb2d4d.diff

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



[issue27639] UserList.__getitem__ doesn't account for slices

2016-07-28 Thread Anton Backer

Changes by Anton Backer <ole...@gmail.com>:


--
hgrepos: +351

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



[issue26724] Serialize dict with non-string keys to JSON — unexpected result

2016-04-09 Thread anton-ryzhov

New submission from anton-ryzhov:

JSON doesn't allow to have non-sting keys in objects, so json.dumps converts 
its to string. But if several keys has one string representation — we'll get 
damaged result as follows:

>>> import json
>>> json.dumps({1: 2, "1": "2"})
'{"1": 2, "1": "2"}'

I think it should raise ValueError in this case.

I've tested this case on 2.7, 3.4 and on trunk version 3.6.

--
components: Library (Lib)
messages: 263108
nosy: anton-ryzhov
priority: normal
severity: normal
status: open
title: Serialize dict with non-string keys to JSON — unexpected result
type: behavior
versions: Python 2.7, Python 3.4, Python 3.5, Python 3.6

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



[issue25490] small mistake in example for random.choice()

2015-10-27 Thread Anton Tagunov

New submission from Anton Tagunov:

Invalid example at this page: https://docs.python.org/3.6/library/random.html

'.items()' is missed in the line below:

>>> population = [val for val, cnt in weighted_choices for i in range(cnt)]


The correct variant:

>>> population = [val for val, cnt in weighted_choices.items() for i in 
>>> range(cnt)]

--
assignee: docs@python
components: Documentation
messages: 253537
nosy: Anton Tagunov, docs@python
priority: normal
severity: normal
status: open
title: small mistake in example for random.choice()
versions: Python 3.5, Python 3.6

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



PY3.5 and nnumpy and scipy installation problem

2015-09-27 Thread paul . anton . letnes
I'll heartily recommend anaconda python. It's got everything you need 
prepackaged. 

Remove what you installed before. 

Cheers
Pauk
-- 
https://mail.python.org/mailman/listinfo/python-list


PY3.5 and nnumpy and scipy installation problem

2015-09-27 Thread paul . anton . letnes
Easiest way of installing is removing the python you've installed already and 
installing continuum's anaconda python 3.x (for x = 4 or 5). It has "batteries 
included" - numpy, scipy and many others! 

Paul
-- 
https://mail.python.org/mailman/listinfo/python-list


Ordering dependent test failures

2015-09-20 Thread paul . anton . letnes
Hi!

Fascinated by the concept of ordering dependent test failures [0], I've run the 
python test suite [1] with 256 different random seeds (took a little more than 
12 hours). The results vary a lot - for instance, the number of tests reported 
as OK varies, the number of skips varies, etc. Since I'm not sure how to report 
or interpret them, I'll just post a summary below.

The test suite was run on arch linux [2] with gcc 5.2.0, with the source code 
taken from a clone of the python repo yesterday [3].

What could I do with all this in order to make more sense of it, and could it 
be of any help what so ever to python development? I'll gladly make the full 
log files available to whomever is interested, in whatever format is 
convenient. In the meantime I'll run more random seeds, because why not.

[0] https://docs.python.org/devguide/buildbots.html#ordering-dependent-failures
[1] ./python -Wd -E -bb -m test -uall -rwW --randseed $k > testlog/${k}.log 2>&1
[2] https://www.archlinux.org/
[3] Python 3.6.0a0 (default:3704cea9fd8e, Sep 19 2015, 16:12:53)

The command "grep OK *.log", where e.g. 5.log is the output of command [1] with 
"--randseed 5":
0.log:380 tests OK.
0.log:OK (skipped=15)
0.log:OK (skipped=15)
0.log:OK (skipped=15)
0.log:OK (skipped=2)
1.log:383 tests OK.
1.log:OK (skipped=2)
2.log:380 tests OK.
2.log:OK (skipped=15)
2.log:OK (skipped=15)
2.log:OK (skipped=15)
2.log:OK (skipped=2)
3.log:380 tests OK.
3.log:OK (skipped=15)
3.log:OK (skipped=15)
3.log:OK (skipped=2)
3.log:OK (skipped=37)
4.log:381 tests OK.
4.log:OK (skipped=15)
4.log:OK (skipped=15)
4.log:OK (skipped=2)
5.log:380 tests OK.
5.log:OK (skipped=15)
5.log:OK (skipped=15)
5.log:OK (skipped=15)
5.log:OK (skipped=2)
6.log:381 tests OK.
6.log:OK (skipped=15)
6.log:OK (skipped=15)
6.log:OK (skipped=2)
7.log:380 tests OK.
7.log:OK (skipped=15)
7.log:OK (skipped=15)
7.log:OK (skipped=15)
7.log:OK (skipped=2)
8.log:381 tests OK.
8.log:OK (skipped=15)
8.log:OK (skipped=15)
8.log:OK (skipped=2)
9.log:382 tests OK.
9.log:OK (skipped=15)
9.log:OK (skipped=2)
10.log:381 tests OK.
10.log:OK (skipped=15)
10.log:OK (skipped=15)
10.log:OK (skipped=2)
11.log:380 tests OK.
11.log:OK (skipped=15)
11.log:OK (skipped=15)
11.log:OK (skipped=2)
11.log:OK (skipped=37)
12.log:380 tests OK.
12.log:OK (skipped=15)
12.log:OK (skipped=15)
12.log:OK (skipped=15)
12.log:OK (skipped=2)
13.log:383 tests OK.
13.log:OK (skipped=2)
14.log:381 tests OK.
14.log:OK (skipped=15)
14.log:OK (skipped=2)
14.log:OK (skipped=39)
15.log:383 tests OK.
15.log:OK (skipped=2)
16.log:381 tests OK.
16.log:OK (skipped=15)
16.log:OK (skipped=15)
16.log:OK (skipped=2)
17.log:381 tests OK.
17.log:OK (skipped=15)
17.log:OK (skipped=15)
17.log:OK (skipped=2)
18.log:381 tests OK.
18.log:OK (skipped=15)
18.log:OK (skipped=15)
18.log:OK (skipped=2)
19.log:381 tests OK.
19.log:OK (skipped=15)
19.log:OK (skipped=15)
19.log:OK (skipped=2)
20.log:381 tests OK.
20.log:OK (skipped=15)
20.log:OK (skipped=15)
20.log:OK (skipped=2)
21.log:382 tests OK.
21.log:OK (skipped=15)
21.log:OK (skipped=2)
22.log:383 tests OK.
22.log:OK (skipped=2)
23.log:383 tests OK.
23.log:OK (skipped=2)
24.log:382 tests OK.
24.log:OK (skipped=15)
24.log:OK (skipped=2)
25.log:381 tests OK.
25.log:OK (skipped=15)
25.log:OK (skipped=15)
25.log:OK (skipped=2)
26.log:380 tests OK.
26.log:OK (skipped=15)
26.log:OK (skipped=15)
26.log:OK (skipped=15)
26.log:OK (skipped=2)
27.log:382 tests OK.
27.log:OK (skipped=15)
27.log:OK (skipped=2)
28.log:381 tests OK.
28.log:OK (skipped=15)
28.log:OK (skipped=15)
28.log:OK (skipped=2)
29.log:383 tests OK.
29.log:OK (skipped=2)
30.log:380 tests OK.
30.log:OK (skipped=15)
30.log:OK (skipped=15)
30.log:OK (skipped=15)
30.log:OK (skipped=2)
31.log:382 tests OK.
31.log:OK (skipped=15)
31.log:OK (skipped=2)
32.log:382 tests OK.
32.log:OK (skipped=15)
32.log:OK (skipped=2)
33.log:383 tests OK.
33.log:OK (skipped=2)
34.log:383 tests OK.
34.log:OK (skipped=2)
35.log:380 tests OK.
35.log:OK (skipped=15)
35.log:OK (skipped=15)
35.log:OK (skipped=15)
35.log:OK (skipped=2)
36.log:382 tests OK.
36.log:OK (skipped=15)
36.log:OK (skipped=2)
37.log:382 tests OK.
37.log:OK (skipped=15)
37.log:OK (skipped=2)
38.log:380 tests OK.
38.log:OK (skipped=15)
38.log:OK (skipped=15)
38.log:OK (skipped=15)
38.log:OK (skipped=2)
39.log:380 tests OK.
39.log:OK (skipped=15)
39.log:OK (skipped=15)
39.log:OK (skipped=15)
39.log:OK (skipped=2)
40.log:381 tests OK.
40.log:OK (skipped=15)
40.log:OK (skipped=15)
40.log:OK (skipped=2)
41.log:383 tests OK.
41.log:OK (skipped=2)
42.log:380 tests OK.
42.log:OK (skipped=15)
42.log:OK (skipped=15)
42.log:OK (skipped=15)
42.log:OK (skipped=2)
43.log:380 tests OK.
43.log:OK (skipped=15)
43.log:OK (skipped=15)
43.log:OK (skipped=15)
43.log:OK (skipped=2)
44.log:383 tests OK.
44.log:OK (skipped=2)
45.log:383 tests OK.
45.log:OK (skipped=2)
46.log:380 tests OK.
46.log:OK (skipped=15)
46.log:OK (skipped=15)
46.log:OK (skipped=15)
46.log:OK (skipped=2)
47.log:383 tests OK.
47.log:OK 

Re: for loop

2015-09-20 Thread paul . anton . letnes
On Sunday, September 20, 2015 at 9:56:06 AM UTC+2, shiva upreti wrote:
> https://ideone.com/BPflPk
> 
> Please tell me why 'print s' statement is being executed inside loop, though 
> I put it outside.
> Please help. I am new to python.

Hi!

Welcome to python, the most awesome programming language!

The code you pasted used both spaces and tabs for indentation. The thing is 
that python, by default, interprets one tab character as 8 spaces, but the 
editor you've used shows it as 4 spaces. To avoid these kinds of headaches, I 
always 1) set my editor to show tabs, so I can detect them, and 2) never use 
tabs when I write code myself. I set my editor to insert 4 spaces whenever I 
hit the "tab" key on my keyboard. If you post the name of your editor, maybe 
someone knows how to do that in yours. You can also detect mixed space/tab 
issues by running "python -t" instead of just "python".

So, your "print s" is in fact inside the loop, since the for loop is indented 
with 4 spaces, and "print s" is indented with 1 tab = 8 spaces. It just doesn't 
look like that to you.

It looks like you're coding in python 2. If you're new to python, I'd recommend 
using a python 3 version, maybe 3.4 or 3.5. You can easily pick up python 2 
later if you need to maintain old code. Of course, it's not a big deal learning 
python 3 if you know python 2 either, but why spend energy on it?

Cheers
Paul
-- 
https://mail.python.org/mailman/listinfo/python-list


Check if dictionary empty with == {}

2015-08-19 Thread Anton
Probably a silly question. 
Let's say I have a dictionary mydict and I need to test if a dictionary is 
empty.

I would use

if not mydict:
do something

But I just came across a line of code like:

if mydict == {}:
do something

which seems odd to me, but maybe there is a valid use case, thus I decided to 
ask the community.

Thanks.

-- 
https://mail.python.org/mailman/listinfo/python-list


[issue22452] addTypeEqualityFunc is not used in assertListEqual

2015-08-18 Thread Anton Barkovsky

Changes by Anton Barkovsky an...@swarmer.me:


--
nosy: +anton.barkovsky

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



  1   2   3   4   >