[issue38758] @dataclass defaults

2019-11-09 Thread Anthony


New submission from Anthony :

Given one of the motivations of @dataclass is to reduce boilerplate code then, 
in the context of @dataclass,

x: list = [] should be equal to x: list = field(default_factory=lambda: [])

The example in PEP 557 is not reasonable. It should be:

class D:
def __init__(self, x=[]):
self.x = x

That x = None works (without specifying a default factory, and is different 
from plain "x")  makes the whole "factory" argument even more bizarre. Why 
would a None Type work, but a List Type not?

I think either the behavior of this should be different or the docs should at 
address this more clearly.

--
components: Interpreter Core
messages: 356306
nosy: anthony
priority: normal
severity: normal
status: open
title: @dataclass defaults
type: behavior
versions: Python 3.7

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



[issue38758] @dataclass defaults

2019-11-13 Thread Anthony

Anthony  added the comment:

Thanks for adding it, I read it now.

And sorry to back track a moment - I love the idea of @dataclass and I can
only imagine how must work it was to implement as I am only a beginner.

I'm looking at this primarily from the narrow view point of a user - not so
much understanding the backdrop of how it can actually work.
But I still think this is worth considering as I think this is common
pattern based on this logic:

When using the default construction method it seems reasonable to pass a
default, such as a List.
Because
def __init__(x=[]):
  self.x = x
Is the cleanest way I can think of to write that.
In this new context, if x: list = [] is the cleanest way to write it.
Therefore it should do that, however it is actually implemented.

Let's imagine for a moment that @dataclass becomes the default way of
constructing classes in python.
Do we really want such a common case to require such verbose language?

Looking at Guido's first comment on this, I think that detection mechanism
is what I would expect to happen. To illustrate verbosely:
https://gist.github.com/swirlingsand/d59d01ef79c5ee93f430ed324199bc65
I clearly misunderstood the way classes get passed by default.
I continue to believe that defining it in the argument should be equal to
defining it after. (if there are no other context items present).

>From a beginners perspective here, It would appear that in a sense the
default init is actually "silently failing" in that the expected (because
of the two instances not being equal to each other as shown in L10 above)
isolation is not happening.
In a sense then, @dataclass is turning that silent "failure" into a
ValueError which is actually better.

What about something like this:
https://gist.github.com/swirlingsand/2494bc482902fada2248698f7b8af61e
If the common case is for it to be None, then this doesn't fire so there's
no cost.
If it's a common default then it handles it as expected.
If it's not found it raises a ValueError like before, so there's no loss or
harm.
A handful of defaults here may cover 80% of cases and the 20% can continue
to be handled by ValueError
In a project with 40 classes with 10 defaults per class that's 400 lines of
code that look like:
[]
instead of
field(default_factory=lambda: [])
(or {} etc.)

Issue #3 has many comments around copying, but that's not my concern, I'm
just talking about the defaults where the attribute is not provided at all
(ie is None).

I did the above example in regular python since I don't know enough about
how @dataclass is implemented, but it seems reasonable that if it can work
in normal python there should be a way to say augment operation() on line
21 with field()

On Wed, Nov 13, 2019 at 10:11 AM Vedran Čačić 
wrote:

>
> Vedran Čačić  added the comment:
>
> Have you read https://github.com/ericvsmith/dataclasses/issues/3?
>
> --
> nosy: +veky
>
> ___
> Python tracker 
> <https://bugs.python.org/issue38758>
> ___
>

--

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



[issue38758] @dataclass defaults

2019-11-13 Thread Anthony

Anthony  added the comment:

To clarify,
A major assumption I'm making is that the default is empty, or the
"copying" is handled as some separately coupled concept.
A motivation here is wanting to do operations like .append() that depend on
the object existing.

On Wed, Nov 13, 2019 at 1:04 PM Anthony Sarkis 
wrote:

> Thanks for adding it, I read it now.
>
> And sorry to back track a moment - I love the idea of @dataclass and I can
> only imagine how must work it was to implement as I am only a beginner.
>
> I'm looking at this primarily from the narrow view point of a user - not
> so much understanding the backdrop of how it can actually work.
> But I still think this is worth considering as I think this is common
> pattern based on this logic:
>
> When using the default construction method it seems reasonable to pass a
> default, such as a List.
> Because
> def __init__(x=[]):
>   self.x = x
> Is the cleanest way I can think of to write that.
> In this new context, if x: list = [] is the cleanest way to write it.
> Therefore it should do that, however it is actually implemented.
>
> Let's imagine for a moment that @dataclass becomes the default way of
> constructing classes in python.
> Do we really want such a common case to require such verbose language?
>
> Looking at Guido's first comment on this, I think that detection mechanism
> is what I would expect to happen. To illustrate verbosely:
> https://gist.github.com/swirlingsand/d59d01ef79c5ee93f430ed324199bc65
> I clearly misunderstood the way classes get passed by default.
> I continue to believe that defining it in the argument should be equal to
> defining it after. (if there are no other context items present).
>
> From a beginners perspective here, It would appear that in a sense the
> default init is actually "silently failing" in that the expected (because
> of the two instances not being equal to each other as shown in L10 above)
> isolation is not happening.
> In a sense then, @dataclass is turning that silent "failure" into a
> ValueError which is actually better.
>
> What about something like this:
> https://gist.github.com/swirlingsand/2494bc482902fada2248698f7b8af61e
> If the common case is for it to be None, then this doesn't fire so there's
> no cost.
> If it's a common default then it handles it as expected.
> If it's not found it raises a ValueError like before, so there's no loss
> or harm.
> A handful of defaults here may cover 80% of cases and the 20% can continue
> to be handled by ValueError
> In a project with 40 classes with 10 defaults per class that's 400 lines
> of code that look like:
> []
> instead of
> field(default_factory=lambda: [])
> (or {} etc.)
>
> Issue #3 has many comments around copying, but that's not my concern, I'm
> just talking about the defaults where the attribute is not provided at all
> (ie is None).
>
> I did the above example in regular python since I don't know enough about
> how @dataclass is implemented, but it seems reasonable that if it can work
> in normal python there should be a way to say augment operation() on line
> 21 with field()
>
>
>
>
>
>
> On Wed, Nov 13, 2019 at 10:11 AM Vedran Čačić 
> wrote:
>
>>
>> Vedran Čačić  added the comment:
>>
>> Have you read https://github.com/ericvsmith/dataclasses/issues/3?
>>
>> --
>> nosy: +veky
>>
>> ___
>> Python tracker 
>> <https://bugs.python.org/issue38758>
>> ___
>>
>

--

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



[issue38758] @dataclass defaults

2019-11-13 Thread Anthony


Anthony  added the comment:

Hey Eric, I think our emails crossed in the wind, please see my comment that 
includes (as a sub component) a similar idea to what's proposed in the article 
you linked.

--

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



[issue38758] @dataclass defaults

2019-11-13 Thread Anthony


Anthony  added the comment:

Vedran thank you for the detailed comments.

I want to separate the idea side and implementation:
The idea is having defaults expressed in a way of least surprise and in the 
least amount of code.

Specifically that 
[1]
makes more sense then 
field(default_factory=lambda: [1])

or more generally that
default
makes more sense then 
field(default_factory=lambda: default)

I agree there's a lot lacking in my example starting point implementation.
Let's not let what's lacking in that implementation distract from the spirit of 
the idea.

The scope of that example is meat to illustrate creating a default that is of 
least surprising, specifically that a new instance of a class is isolated.
But I think the point of whether or not the default is isolated feels like a 
distraction. 

If a motivation for using type annotations is to restrict to reduce errors. To 
me, "prototyping" defaults by having them declared as soon as possible in the 
class is a further restriction. I believe that's a reasonable coding practice, 
and actually a good thing. 

To me this is the current situation, in order to setup a class using @dataclass 
a user must either:

a) Have a relatively in depth understanding of python. I think proofs of that 
include both PEP having to have a section justifying that. And that there was 
such discussion in the issue. 
A point of higher level languages is to nicely abstract lower level APIs, if I 
have to learn the lower level API in order to use the language it reduces the 
benefit, and that's really what the points made sound like.

b) Calling two "special" / additional functions and adding a (relatively) large 
amount of code. I can't think of anything else in python where the default 
method requires knowing two separate additional functions! Python is all about 
short, semantically meaningful expressions yet this feels like the total 
opposite!

If setting up defaults is a common point of error or "bad code" then why not 
setup the standard library in such a way that it does it right?
ie that a user can specify the default they want and the library sets up the 
default in the right way.
If that's as a separate object, or a mutable object, either way. The point 
being that setting up a default should be straightforward.

This is my first attempt at a contribution, even if all it is is highlighting a 
problem and the "solution" I'm suggesting may be the wrong one. But so far all 
of comments feel like they are defending a cascade of "not ideal" situations. 
Let's try actually looking at the root from the user's perspective and how can 
we improve this!

--
nosy: +gvanrossum

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



[issue46147] Support AddressSanitizer in Windows build

2021-12-21 Thread anthony shaw


New submission from anthony shaw :

I'd like to compile my C-extensions with ASAN for testing in Windows, but they 
cannot be loaded as the host python.exe process needs to be compiled with ASAN. 

https://docs.microsoft.com/en-us/cpp/sanitizers/asan?view=msvc-170#ide-msbuild

The EnableASAN flag would be a setting in vcxproj files within the PCBuild 
solution, and a flag in the build.bat to enable it.

--
components: Build, Windows
messages: 409006
nosy: anthonypjshaw, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Support AddressSanitizer in Windows build
type: enhancement

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



[issue46147] Support AddressSanitizer in Windows build

2021-12-21 Thread anthony shaw


anthony shaw  added the comment:

After some experimentation, this can be done if you enable ASAN in all projects 
except python3dll.vcxproj

I think it would make sense (if this were supported) to have a flag in 
build.bat like there is for pgo

`build.bat --asan`

--

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



[issue46491] typing: allow Annotated in outermost scope

2022-01-25 Thread Anthony Sottile


Anthony Sottile  added the comment:

should this behaviour change be backported?  it potentially creates an annoying 
edgecase where code seemingly works unless you use an older patch version

since this isn't a bugfix I wouldn't expect this to land in 3.9 and 3.10

--
nosy: +Anthony Sottile

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



[issue46491] typing: allow Annotated in outermost scope

2022-01-25 Thread Anthony Sottile


Anthony Sottile  added the comment:

to me this is the same as the Union[Pattern] / Union[Match] "fixes" that landed 
in 3.5.3 -- and the pain caused by using that and having CI pass (because of 
modern 3.5.x) but having spurious bug reports from users stuck on 3.5.2

or in 3.6.1 when NamedTuple was "fixed" to allow methods, again having CI pass 
with modern pythons but having frustrated users running 3.6.0

I forsee the same class of problems here with Annotated where it works great in 
3.10.3 and 3.9.11 but anyone stuck on 3.10.2 or 3.9.10 or older will be broken

--

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



[issue46491] typing: allow Annotated in outermost scope

2022-01-25 Thread Anthony Sottile


Anthony Sottile  added the comment:

3.7.2 has another example where OrderedDict was added to typing

I don't have any personal investment in this particular change but I've had 
quite a few unhappy consumers of libraries due to instability in typing apis 
between patch versions in the past (heh and they're especially frustrated 
because they don't care about type checking and just want functional software)

it's also difficult and/or not cost effective to add every patch version to a 
CI matrix to catch these sorts of problems

--

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



[issue46704] Parser API not checking for null-terminator

2022-02-09 Thread anthony shaw


New submission from anthony shaw :

In tokenizer.c, the translate_newlines() function does a `strlen()` on the 
input string, if the string is not null-terminated, e.g. 
'\xbe' this leads to a heap-buffer-overflow. The overflow is not exploitable, 
but if there are further changes to the parser, it might be worth using a 
strlen() alternative, like strnlen().

static char *
translate_newlines(const char *s, int exec_input, struct tok_state *tok) {
int skip_next_lf = 0;
size_t needed_length = strlen(s) + 2, final_length;


This leads to a heap-buffer-overflow detected by ASAN in a simple reproducible 
example, calling PyRun_StringFlags() from the LLVM fuzzer:


fuzz_target(47084,0x11356f600) malloc: nano zone abandoned due to inability to 
preallocate reserved vm space.
Dictionary: 35 entries
INFO: Running with entropic power schedule (0xFF, 100).
INFO: Seed: 3034498392
INFO: Loaded 1 modules   (43 inline 8-bit counters): 43 [0x10a2b71e8, 
0x10a2b7213), 
INFO: Loaded 1 PC tables (43 PCs): 43 [0x10a2b7218,0x10a2b74c8), 
INFO:1 files found in ../Tests/fuzzing/corpus
INFO: -max_len is not provided; libFuzzer will not generate inputs larger than 
4096 bytes
=
==47084==ERROR: AddressSanitizer: heap-buffer-overflow on address 
0x60203131 at pc 0x00010bd1d555 bp 0x7ff7b5da0590 sp 0x7ff7b5d9fd50
READ of size 2 at 0x60203131 thread T0
#0 0x10bd1d554 in wrap_strlen+0x184 
(libclang_rt.asan_osx_dynamic.dylib:x86_64h+0x15554)
#1 0x10b12132b in translate_newlines+0x1b (Python:x86_64+0x5d32b)
#2 0x10b12071c in _PyParser_ASTFromString+0x1ac (Python:x86_64+0x5c71c)
#3 0x10b2f86de in PyRun_StringFlags+0x5e (Python:x86_64+0x2346de)
#4 0x10a25ec6b in CompileCode(char const*) fuzz_target.cpp:54
#5 0x10a25f247 in LLVMFuzzerTestOneInput fuzz_target.cpp:68
#6 0x10a27aff3 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, 
unsigned long) FuzzerLoop.cpp:611
#7 0x10a27c3c4 in 
fuzzer::Fuzzer::ReadAndExecuteSeedCorpora(std::__1::vector >&) FuzzerLoop.cpp:804
#8 0x10a27c859 in fuzzer::Fuzzer::Loop(std::__1::vector >&) FuzzerLoop.cpp:857
#9 0x10a26aa5f in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char 
const*, unsigned long)) FuzzerDriver.cpp:906
#10 0x10a298e42 in main FuzzerMain.cpp:20
#11 0x1134f44fd in start+0x1cd (dyld:x86_64+0x54fd)

0x60203131 is located 0 bytes to the right of 1-byte region 
[0x60203130,0x60203131)
allocated by thread T0 here:
#0 0x10bd58a0d in wrap__Znam+0x7d 
(libclang_rt.asan_osx_dynamic.dylib:x86_64h+0x50a0d)
#1 0x10a27af02 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, 
unsigned long) FuzzerLoop.cpp:596
#2 0x10a27c3c4 in 
fuzzer::Fuzzer::ReadAndExecuteSeedCorpora(std::__1::vector >&) FuzzerLoop.cpp:804
#3 0x10a27c859 in fuzzer::Fuzzer::Loop(std::__1::vector >&) FuzzerLoop.cpp:857
#4 0x10a26aa5f in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char 
const*, unsigned long)) FuzzerDriver.cpp:906
#5 0x10a298e42 in main FuzzerMain.cpp:20
#6 0x1134f44fd in start+0x1cd (dyld:x86_64+0x54fd)

SUMMARY: AddressSanitizer: heap-buffer-overflow 
(libclang_rt.asan_osx_dynamic.dylib:x86_64h+0x15554) in wrap_strlen+0x184
Shadow bytes around the buggy address:
  0x1c0405d0: fa fa 02 fa fa fa 02 fa fa fa 02 fa fa fa 02 fa
  0x1c0405e0: fa fa 02 fa fa fa 02 fa fa fa 02 fa fa fa 02 fa
  0x1c0405f0: fa fa 03 fa fa fa 03 fa fa fa 03 fa fa fa 03 fa
  0x1c040600: fa fa 01 fa fa fa 01 fa fa fa 01 fa fa fa 01 fa
  0x1c040610: fa fa 00 00 fa fa 00 fa fa fa 00 fa fa fa 00 00
=>0x1c040620: fa fa 00 fa fa fa[01]fa fa fa fd fa fa fa fd fd
  0x1c040630: fa fa fd fa fa fa fd fa fa fa 00 fa fa fa 04 fa
  0x1c040640: fa fa 00 00 fa fa 01 fa fa fa 01 fa fa fa 01 fa
  0x1c040650: fa fa fd fa fa fa fd fa fa fa fd fd fa fa 01 fa
  0x1c040660: fa fa 00 00 fa fa 01 fa fa fa fd fa fa fa fd fa
  0x1c040670: fa fa 01 fa fa fa 06 fa fa fa 00 00 fa fa 06 fa
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:   00
  Partially addressable: 01 02 03 04 05 06 07 
  Heap left redzone:   fa
  Freed heap region:   fd
  Stack left redzone:  f1
  Stack mid redzone:   f2
  Stack right redzone: f3
  Stack after return:  f5
  Stack use after scope:   f8
  Global redzone:  f9
  Global init order:   f6
  Poisoned by user:f7
  Container overflow:  fc
  Array cookie:ac
  Intra object redzone:bb
  ASan internal:   fe
  Left alloca redzone: ca
  Right alloca redzone:cb
  Shadow gap:  cc
==47084==ABORTING
MS: 0 ; base unit: 


artifact_prefix='./'; Test unit written to 
./crash-da39a3ee5e6b4b0d3255bfef95601890afd80709
Base64: 
zsh: abort  ./fuzz_target -dict=../Tests/fuzzing/python.dict -o

[issue46707] Parser hanging on stacked { tokens

2022-02-09 Thread anthony shaw


New submission from anthony shaw :

Providing an (invalid) input to the parser causes an exponentially-slow DoS to 
the Python executable in 3.10.

e.g.

python3.10 -c "{:"

takes ~2 seconds

python3.10 -c ":"

takes ~22 seconds

Tested this all the way up to 
d```{{{ef f():y

which took over an hour

--
components: Parser
keywords: 3.10regression
messages: 412972
nosy: anthonypjshaw, lys.nikolaou, pablogsal
priority: normal
severity: normal
status: open
title: Parser hanging on stacked { tokens
type: crash

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



[issue46707] Parser hanging on stacked { tokens

2022-02-09 Thread anthony shaw


Change by anthony shaw :


--
versions: +Python 3.10, Python 3.11

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



[issue1102] Add support for _msi.Record.GetString() and _msi.Record.GetInteger()

2007-09-04 Thread Anthony Tuininga

Changes by 
Anthony Tuininga
:


--
components: Library (Lib)
severity: normal
status: open
title: Add support for _msi.Record.GetString() and _msi.Record.GetInteger()
type: behavior
versions: Python 2.5

__
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1102>
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1102] Add support for _msi.Record.GetString() and _msi.Record.GetInteger()

2007-09-04 Thread Anthony Tuininga

New submission from 
Anthony Tuininga
:

Attached is a patch that adds the requested support. This is in relation
to the thread at

http://www.gossamer-threads.com/lists/python/python/584264

In addition to the two methods I also "fixed" Fetch() by ensuring that
when the records are exhausted None is returned instead of an error.

If something further is required of me or I submitted this patch
incorrectly, please let me know so I don't screw it up next time. :-)

--
nosy: +atuining

__
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1102>
__Index: _msi.c
===
--- _msi.c  (revision 57972)
+++ _msi.c  (working copy)
@@ -350,6 +350,34 @@
 }
 
 static PyObject*
+record_getstring(msiobj* record, PyObject *args)
+{
+int status, field, size;
+PyObject *value;
+char *data;
+
+if (!PyArg_ParseTuple(args, "i:GetString", &field))
+   return NULL;
+
+size = 0;
+status = MsiRecordGetString(record->h, field, "", &size);
+if (status != ERROR_MORE_DATA)
+return msierror(status);
+size++;
+data = PyMem_Malloc(size);
+if (!data)
+return PyErr_NoMemory();
+status = MsiRecordGetString(record->h, field, data, &size);
+if (status != ERROR_SUCCESS) {
+PyMem_Free(data);
+return msierror(status);
+}
+value = PyString_FromString(data);
+PyMem_Free(data);
+return value;
+}
+
+static PyObject*
 record_setstring(msiobj* record, PyObject *args)
 {
 int status;
@@ -384,6 +412,22 @@
 }
 
 static PyObject*
+record_getinteger(msiobj* record, PyObject *args)
+{
+int field, value;
+
+if (!PyArg_ParseTuple(args, "i:GetInteger", &field))
+   return NULL;
+
+value = MsiRecordGetInteger(record->h, field);
+if (value != MSI_NULL_INTEGER)
+return PyInt_FromLong(value);
+
+Py_INCREF(Py_None);
+return Py_None;
+}
+
+static PyObject*
 record_setinteger(msiobj* record, PyObject *args)
 {
 int status;
@@ -405,10 +449,14 @@
 static PyMethodDef record_methods[] = {
 { "GetFieldCount", (PyCFunction)record_getfieldcount, METH_NOARGS, 
PyDoc_STR("GetFieldCount() -> int\nWraps MsiRecordGetFieldCount")},
+{ "GetString", (PyCFunction)record_getstring, METH_VARARGS, 
+   PyDoc_STR("GetString(field) -> value\nWraps MsiRecordGetString")},
 { "SetString", (PyCFunction)record_setstring, METH_VARARGS, 
PyDoc_STR("SetString(field,str) -> None\nWraps MsiRecordSetString")},
 { "SetStream", (PyCFunction)record_setstream, METH_VARARGS, 
PyDoc_STR("SetStream(field,filename) -> None\nWraps 
MsiRecordSetInteger")},
+{ "GetInteger", (PyCFunction)record_getinteger, METH_VARARGS, 
+   PyDoc_STR("GetInteger(field) -> value\nWraps MsiRecordGetInteger")},
 { "SetInteger", (PyCFunction)record_setinteger, METH_VARARGS, 
PyDoc_STR("SetInteger(field,int) -> None\nWraps MsiRecordSetInteger")},
 { "ClearData", (PyCFunction)record_cleardata, METH_NOARGS, 
@@ -662,8 +710,13 @@
 int status;
 MSIHANDLE result;
 
-if ((status = MsiViewFetch(view->h, &result)) != ERROR_SUCCESS)
-   return msierror(status);
+status = MsiViewFetch(view->h, &result);
+if (status == ERROR_NO_MORE_ITEMS) {
+Py_INCREF(Py_None);
+return Py_None;
+}
+if (status != ERROR_SUCCESS)
+return msierror(status);
 
 return record_new(result);
 }
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1102] Add support for _msi.Record.GetString() and _msi.Record.GetInteger()

2007-09-04 Thread Anthony Tuininga

Changes by 
Anthony Tuininga
:


--
type: behavior -> 

__
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1102>
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1104] msilib.SummaryInfo.GetProperty() truncates the string by one character

2007-09-04 Thread Anthony Tuininga

New submission from 
Anthony Tuininga
:

Attached is a patch that fixes the truncation of the property values
returned by msilib.SummaryInfo.GetProperty(). Unfortunately Microsoft
has deemed it necessary to return the size of the string without the
null termination character but insists upon the size including it when
passing it in. Arggh!

--
components: Library (Lib)
files: _msi.patch2.txt
messages: 55649
nosy: atuining
severity: normal
status: open
title: msilib.SummaryInfo.GetProperty() truncates the string by one character
versions: Python 2.5

__
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1104>
__Index: _msi.c
===
--- _msi.c  (revision 57972)
+++ _msi.c  (working copy)
@@ -488,7 +536,7 @@
 FILETIME fval;
 char sbuf[1000];
 char *sval = sbuf;
-DWORD ssize = sizeof(sval);
+DWORD ssize = sizeof(sbuf);
 
 if (!PyArg_ParseTuple(args, "i:GetProperty", &field))
return NULL;
@@ -496,7 +544,8 @@
 status = MsiSummaryInfoGetProperty(si->h, field, &type, &ival, 
&fval, sval, &ssize);
 if (status == ERROR_MORE_DATA) {
-   sval = malloc(ssize);
+ssize++;
+   sval = malloc(ssize);
 status = MsiSummaryInfoGetProperty(si->h, field, &type, &ival, 
&fval, sval, &ssize);
 }
@@ -508,7 +557,7 @@
PyErr_SetString(PyExc_NotImplementedError, "FILETIME result");
return NULL;
case VT_LPSTR:
-   result = PyString_FromStringAndSize(sval, ssize);
+   result = PyString_FromString(sval);
if (sval != sbuf)
free(sval);
return result;
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1128] msilib.Directory.make_short only handles file names with a single dot in them

2007-09-07 Thread Anthony Tuininga

New submission from 
Anthony Tuininga
:

Attached is a patch that fixes the handling of file names with 0 or 2 or
more dots in them.

--
components: Library (Lib)
files: msilib.__init__.patch
messages: 55736
nosy: atuining
severity: normal
status: open
title: msilib.Directory.make_short only handles file names with a single dot in 
them
versions: Python 2.5

__
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1128>
__

msilib.__init__.patch
Description: Binary data
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13641] decoding functions in the base64 module could accept unicode strings

2011-12-28 Thread Anthony Kong

Changes by Anthony Kong :


--
nosy: +Anthony.Kong

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



[issue6484] No unit test for mailcap module

2011-08-21 Thread Anthony Briggs

Changes by Anthony Briggs :


--
nosy: +anthonyb, ncoghlan
versions: +Python 3.3 -Python 3.2

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



[issue6484] No unit test for mailcap module

2011-08-21 Thread Anthony Briggs

Anthony Briggs  added the comment:

Added ncoghlan to the nosy list - we're reviewing/fixing unit test coverage as 
part of the sprints at PyconAU. Thanks Gnofi!

--

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



[issue12811] Tabnanny doesn't close its tokenize files properly

2011-08-21 Thread Anthony Briggs

New submission from Anthony Briggs :

Unlike Python 2, Python 3 warns when files aren't closed properly, which raises 
lots of warnings when running tabnanny:

~/devinabox/cpython$ ./python -m tabnanny Lib/
/home/anthony/devinabox/cpython/Lib/tabnanny.py:93: ResourceWarning: unclosed 
file <_io.TextIOWrapper name='Lib/sunau.py' mode='r' encoding='utf-8'>
  check(fullname)
/home/anthony/devinabox/cpython/Lib/tabnanny.py:93: ResourceWarning: unclosed 
file <_io.TextIOWrapper name='Lib/sre_compile.py' mode='r' encoding='utf-8'>
  check(fullname)
/home/anthony/devinabox/cpython/Lib/tabnanny.py:93: ResourceWarning: unclosed 
file <_io.TextIOWrapper name='Lib/this.py' mode='r' encoding='utf-8'>
  check(fullname)
/home/anthony/devinabox/cpython/Lib/tabnanny.py:93: ResourceWarning: unclosed 
file <_io.TextIOWrapper name='Lib/difflib.py' mode='r' encoding='utf-8'>
  check(fullname)

The attached patch fixes the problem.

--
components: Library (Lib)
files: tabnanny_close_file.patch
keywords: patch
messages: 142681
nosy: anthonyb, ncoghlan
priority: normal
severity: normal
status: open
title: Tabnanny doesn't close its tokenize files properly
type: resource usage
versions: Python 3.3
Added file: http://bugs.python.org/file22992/tabnanny_close_file.patch

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



[issue12853] global name 'r' is not defined in upload.py

2011-08-29 Thread Anthony Kong

Changes by Anthony Kong :


--
nosy: +Anthony.Kong

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



[issue9590] __init__ TypeError reverses expected vs received args

2010-08-13 Thread Anthony Long

New submission from Anthony Long :

import unittest
from selenium import selenium


class SetupSomething(unittest.TestCase):

def setUp(self, URL):

self.selenium = selenium("localhost", , "*firefox", self.URL)


def tearDown(self):
pass


class TestSomething(SetupSomething):
def __init__():
print "bug."

def setUp(self):
self.URL = "http://google.com/";

def tearDown(self):
pass

def test_tester(self):
self.selenium.open('/')
print "no"



unittest.main()


TypeError: '__init__() takes no arguments (2 given)'

--
messages: 113802
nosy: antlong
priority: normal
severity: normal
status: open
title: __init__ TypeError reverses expected vs received args
versions: Python 2.6, Python 2.7

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



[issue8194] Incompatible API change in xmlrpclib.Transport.parse_response() of Python 2.7 and 3.2

2010-10-28 Thread Anthony Long

Anthony Long  added the comment:

Patched my installation of python27 (via macports, snow leopard) and the patch 
was successful. Verified patch works in a limited capacity, using yolk.

--
nosy: +antlong

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



[issue11327] Running test_time.py in python27 caused python to unexpectedly quit

2011-02-25 Thread Anthony Long

New submission from Anthony Long :

I ran 

python test_time.py 

and python immediately crashed.

This is the trace from mac's error reporter: 

http://dpaste.de/Jsw7/

--
components: Tests
messages: 129502
nosy: antlong
priority: normal
severity: normal
status: open
title: Running test_time.py in python27 caused python to unexpectedly quit
type: crash
versions: Python 2.7

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



[issue6501] Fatal error on startup with invalid PYTHONIOENCODING

2011-04-01 Thread Anthony Tuininga

Changes by Anthony Tuininga :


--
nosy: +atuining

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



[issue11846] Implementation question for (-5) - 256 caching, and doc update for c-api/int.html

2011-04-14 Thread Anthony Long

New submission from Anthony Long :

http://docs.python.org/c-api/int.html

"The current implementation keeps an array of integer objects for all integers 
between -5 and 256, when you create an int in that range you actually just get 
back a reference to the existing object. So it should be possible to change the 
value of 1. I suspect the behaviour of Python in this case is undefined. :-)"

This paragraph should be changed to reflect that you can (by construction) 
mutate anything you want in C, and (as per suggestion of dmalcolm)

"The current implementatin consolidates integers in the range -5 to 256 
(inclusive) into singleton instances.  Do not manipulate the internal value of 
a PyIntObject after creation."

Also, the last line of that paragraph insinuates this functionality (caching of 
-5 to 256) is undocumented. I searched for a good while for an answer for this, 
and I didn't find one. If there is something written on the implementation 
details surrounding why '-5 is -5' works, while -6 is -6' wouldn't. 

If there is nothing written about this, I will put something together. My final 
question however which I have not been able to find an answer for, is: Is this 
even necessary functionality?

I encountered around 100 blog posts and a couple of stackoverflow questions 
about why this fails, and it seems like 1) a source of confusion 2) a point of 
ridicule. Is it really necessary?

>>> id(1)
4298196440
>>> a = 1
>>> id(a)
4298196440
>>> id(3000)
4320396376
>>> a = 3000
>>> id(a)
4320396160
>>>

--
components: Library (Lib)
messages: 133769
nosy: antlong
priority: normal
severity: normal
status: open
title: Implementation question for (-5) - 256 caching, and doc update for 
c-api/int.html
type: behavior

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



[issue11846] Remove non-guaranteed implementation details from docs.

2011-04-21 Thread Anthony Long

Anthony Long  added the comment:

I'll have a doc patch shortly.

Also, I am working on defining a solid range. Memory is not an issue like it 
was back in 1991 when this range was originally implemented, so we can go 
higher and get a bigger performance boost. This will be very important (to 
some, admittedly) in Python 3, where there is no distinction between PyInts and 
PyLongs (more processing req'd), which could benefit from further optimization 
of the range.

Going to be doing benchmarking, -256 to 256 seems like a good place to start. 
If anyone has app's i should benchmark with in mind, feel free to let me know.

--
resolution:  -> accepted
title: Implementation question for (-5) - 256 caching, and doc update for 
c-api/int.html -> Remove non-guaranteed implementation details from docs.

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



[issue11846] Remove non-guaranteed implementation details from docs.

2011-04-21 Thread Anthony Long

Anthony Long  added the comment:

My plan is to document it, as it exists, in the current implementation. That's 
a start atleast, and will provide an entry point for further documentation in 
the future should it be changed again.

--

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



[issue5863] bz2.BZ2File should accept other file-like objects.

2011-01-24 Thread Anthony Long

Anthony Long  added the comment:

Are there tests for this?

--
nosy: +antlong

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



[issue10976] json.loads() throws TypeError on bytes object

2011-01-24 Thread Anthony Long

Anthony Long  added the comment:

Works for me, py2.7 on snow leopard.

--
nosy: +antlong

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



[issue11002] 'Upload' link on Files page is broken

2011-01-24 Thread Anthony Long

New submission from Anthony Long :

On pypi, when you are inside of your packages' files area, the link that is 
attached to 

1. Use the setup.py "upload" command. # "upload"

is broken, it links to http://www.python.org/doc/dist/package-upload.html which 
returns a 404.

http://d.pr/mmie

--
assignee: docs@python
components: Documentation
messages: 126988
nosy: antlong, docs@python
priority: normal
severity: normal
status: open
title: 'Upload' link on Files page is broken
type: behavior

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



[issue11014] 'filter' argument for Tarfile.add needs to be a keyword-only argument

2011-01-26 Thread Anthony Long

Anthony Long  added the comment:

Tests trying all positions and expecting an appropriate TypeError should be 
included.

--
nosy: +antlong

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



[issue11014] 'filter' argument for Tarfile.add needs to be a keyword-only argument

2011-01-26 Thread Anthony Long

Changes by Anthony Long :


--
nosy:  -antlong

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



[issue11014] 'filter' argument for Tarfile.add needs to be a keyword-only argument

2011-01-26 Thread Anthony Long

Anthony Long  added the comment:

Strange, I didn't see it until this email came. Probably an old browser cache.

Either way, looks good to me. No issues on mac SL.

--
nosy: +antlong

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



[issue1102] Add support for _msi.Record.GetString() and _msi.Record.GetInteger()

2008-06-04 Thread Anthony Tuininga

Anthony Tuininga <[EMAIL PROTECTED]> added the comment:

This patch appears to be mostly duplicated by patch 2125 which has been
accepted. Would it be helpful if I separated out the parts that have now
been accepted?

___
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1102>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2732] curses.textpad loses characters at the end of lines

2008-06-21 Thread Anthony Lenton

Anthony Lenton <[EMAIL PROTECTED]> added the comment:

This doesn't happen to me with 2.6 compiled from HEAD, or with 2.5.2
shipped with Ubuntu Hardy.

In both cases the output is:

Contents of text box: '123456789\n123456789\n'

--
nosy: +elachuni

___
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue2732>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2569] default_scheme in urlparse.urlparse() useless

2008-06-21 Thread Anthony Lenton

Anthony Lenton <[EMAIL PROTECTED]> added the comment:

In http://bugs.python.org/issue754016 there's already a discussion about
this.
The RFC that urlparse is following (rfc 1808) requires the net_loc
component to start with // even if the scheme component is missing,
which is why urlparse("www","http") puts the 'www' in to the path
component instead of net_loc.

It seems that this is indeed the intended behavior, and the patch for
issue 754016 adds a docfix clarifying this.

--
nosy: +elachuni

___
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue2569>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2569] default_scheme in urlparse.urlparse() useless

2008-06-21 Thread Anthony Lenton

Changes by Anthony Lenton <[EMAIL PROTECTED]>:


--
nosy: +facundobatista

___
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue2569>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue754016] urlparse goes wrong with IP:port without scheme

2008-06-21 Thread Anthony Lenton

Anthony Lenton <[EMAIL PROTECTED]> added the comment:

I agree with facundobatista that the patch is bad, but for a different
reason: it now breaks with:

>>> import urlparse
>>> urlparse.urlparse ('http:')
Traceback (most recent call last):
  File "", line 1, in 
  File "/home/anthony/svn/python26/Lib/urlparse.py", line 108, in urlparse
tuple = urlsplit(url, scheme, allow_fragments)
  File "/home/anthony/svn/python26/Lib/urlparse.py", line 148, in urlsplit
if i > 0 and not url[i+1].isdigit():
IndexError: string index out of range

I'm afraid that it it's not evident that the expected behavior isn't
evident.

Take for example:

>>> import urlparse
>>> urlparse.urlparse('some.com', 'http')
ParseResult(scheme='http', netloc='', path='some.com', params='',
query='', fragment='')

Is the url referring to the some.com domain or to a windows executable file?

If you're using urlparse to parse only absolute urls then probably you
want the first component to be considered a net_loc, but not if you're
thinking of accepting also relative urls.

It would probably be better to be explicit and raise an exception if the
url is invalid, so that the user can prepend a '//' and resubmit if
needed.  Also we'd probably stop seeing bugreports about this issue :)

--
nosy: +elachuni

___
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue754016>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1556] Failure when calling __str__ for MIMEBase(message, rfc822) objects

2008-06-21 Thread Anthony Lenton

Anthony Lenton <[EMAIL PROTECTED]> added the comment:

I don't really think the MIMEBase class is supposed to be used like
this, or at all: it behaves more like a Multipart message in that it
expects to carry a list of MIMEBase objects as a payload (not a string!)
though it doesn't define a boundary by default.

You can carry on using the MIMEBase class, but changing the line that says:

attachment.set_payload(file(filename).read( ))

for:

attachment.set_payload([MIMEText(file(filename).read())])

I'd recommend you to use:

attachment = Message()
attachment.set_payload(file(filename).read())

or if you want a multipart message:

attachment = MIMEMultipart()
text = MIMEText(file(filename).read())
attachment.attach(text)

--
nosy: +elachuni

___
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1556>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1441530] socket read() can cause MemoryError in Windows

2008-09-09 Thread Anthony Lenton

Anthony Lenton <[EMAIL PROTECTED]> added the comment:

I confirm that the bug occurs with Python 2.5.1 on Windows XP.  Also,
anglocelt's fix worked fine for me.

--
nosy: +elachuni

___
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1441530>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1441530] socket read() can cause MemoryError in Windows

2008-09-11 Thread Anthony Lenton

Anthony Lenton <[EMAIL PROTECTED]> added the comment:

It's probably just a typo from copying from an editor, but there is a
bug in the workaround.  It should be:

maxRead = 100
class MySSL (imaplib.IMAP4_SSL):
  def read (self, n):
#print "..Attempting to read %d bytes" % n
  if n <= maxRead:
return imaplib.IMAP4_SSL.read (self, n)
  else:
soFar = 0
result = ""
while soFar < n:
  thisFragmentSize = min(maxRead, n-soFar)
  #print "..Reading fragment size %s" % thisFragmentSize
  fragment =\
imaplib.IMAP4_SSL.read (self, thisFragmentSize)
  result += fragment
  soFar += thisFragmentSize # only a few, so not a tragic o/head
return result

(With one less level of indentation in the last line).
Apart from that, the fix works wonderfully.

___
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1441530>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue839159] iterators broken for weak dicts

2010-05-06 Thread Anthony Lenton

Anthony Lenton  added the comment:

Probably old news, but this also affects 2.5.4.

--
nosy: +elachuni
versions: +Python 2.5

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



[issue1224] SimpleHTTPServer doesn't understand // at beginning of path anymore

2008-02-17 Thread Anthony Lenton

Anthony Lenton added the comment:

Attached is an diff against trunk that adds philfr's suggesitions.  I've
also added a test file for testing url parsing, so's these things stay
fixed.  Updated Misc/NEWS.  No doc or functionallity modified.

--
nosy: +elachuni, facundobatista
Added file: http://bugs.python.org/file9451/1224.diff

__
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1224>
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1102] Add support for _msi.Record.GetString() and _msi.Record.GetInteger()

2008-10-20 Thread Anthony Tuininga

Changes by Anthony Tuininga <[EMAIL PROTECTED]>:


Removed file: http://bugs.python.org/file8385/_msi.patch.txt

___
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1102>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1102] Add support for _msi.Record.GetString() and _msi.Record.GetInteger()

2008-10-20 Thread Anthony Tuininga

Anthony Tuininga <[EMAIL PROTECTED]> added the comment:

With apologies for the delay, I have modified the patch to remove the
stuff that has been added already. Some of the other changes are to make
use of new C API functionality but they can be ignored, if desired. The
changes that are relevant are in the view_fetch() routine. Again, if you
have questions, let me know.

--
versions: +Python 2.6 -Python 2.5
Added file: http://bugs.python.org/file11840/_msi.patch.txt

___
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1102>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1109963] bdist_wininst ignores build_lib from build command

2008-10-29 Thread Anthony Tuininga

Anthony Tuininga <[EMAIL PROTECTED]> added the comment:

This problem also occurs in the bdist_msi command.

--
versions: +Python 2.5, Python 2.6

___
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1109963>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4284] Python 2.6 64-bit + Vista 64 = Bad MSVCRT

2008-11-08 Thread Anthony Awtrey

New submission from Anthony Awtrey <[EMAIL PROTECTED]>:

Here is the reproduction process. Get Windows box running Vista 64-bit.
Download the Python 2.6 64-bit version. Write a script that imports
escape from saxutils. See this:

C:\Python26>python.exe example_xml_script.py > out.xml
Traceback (most recent call last):
  File "example_xml_script.py", line 11, in 
from xml.sax.saxutils import escape
  File "C:\Python26\lib\xml\sax\saxutils.py", line 6, in 
import os, urlparse, urllib, types
  File "C:\Python26\lib\urllib.py", line 26, in 
import socket
  File "C:\Python26\lib\socket.py", line 46, in 
import _socket
ImportError: DLL load failed: The application has failed to start
because its side-by-side configuration is incorrect. Please see the
application event log for more detail.

EventViewer says:

Activation context generation failed for "C:\Python26\DLLs\_socket.pyd".
Error in manifest or policy file
"C:\Python26DLLs\Microsoft.VC90.CRT.MANIFEST" on line 12. 
The value "../msvcr90.dll" of attribute "name" in element
"urn:schemas-microsoft-com:asm.v1^file" is invalid.

Go download the MSVCRT directly and install it:

http://www.microsoft.com/downloads/details.aspx?familyid=9B2DA534-3E03-4391-8A4D-074B9F2BC1BF&displaylang=en

Then the problem goes away.

This issue is particular only to the Python 2.6 64-bit version, as the
32-bit version runs just fine.

--
components: Windows
messages: 75643
nosy: DaGoodBoy
severity: normal
status: open
title: Python 2.6 64-bit + Vista 64 = Bad MSVCRT
type: crash
versions: Python 2.6

___
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue4284>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1717] Get rid of more references to __cmp__

2009-02-16 Thread Anthony Tuininga

Anthony Tuininga  added the comment:

Removing cmp() breaks distutils. I get the following exception, for
example using the just released version 3.0.1:

Traceback (most recent call last):
  File "setup.py", line 318, in 
classifiers = classifiers)
  File "c:\Python30\lib\distutils\core.py", line 149, in setup
dist.run_commands()
  File "c:\Python30\lib\distutils\dist.py", line 942, in run_commands
self.run_command(cmd)
  File "c:\Python30\lib\distutils\dist.py", line 962, in run_command
cmd_obj.run()
  File "c:\Python30\lib\distutils\command\build.py", line 128, in run
self.run_command(cmd_name)
  File "c:\Python30\lib\distutils\cmd.py", line 317, in run_command
self.distribution.run_command(command)
  File "c:\Python30\lib\distutils\dist.py", line 962, in run_command
cmd_obj.run()
  File "c:\Python30\lib\distutils\command\build_ext.py", line 306, in run
force=self.force)
  File "c:\Python30\lib\distutils\ccompiler.py", line 1110, in new_compiler
return klass(None, dry_run, force)
  File "c:\Python30\lib\distutils\cygwinccompiler.py", line 314, in __init__
if self.gcc_version <= "2.91.57":
  File "c:\Python30\lib\distutils\version.py", line 64, in __le__
c = self._cmp(other)
  File "c:\Python30\lib\distutils\version.py", line 341, in _cmp
return cmp(self.version, other.version)
NameError: global name 'cmp' is not defined

--
nosy: +atuining

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



[issue47152] Reorganize the re module sources

2022-04-02 Thread Anthony Sottile


Anthony Sottile  added the comment:

would it be possible to expose `parse_template` -- or at least some way to 
validate that a regex replacement string is correct prior to executing the 
replacement?

I'm currently using that for my text editor: 
https://github.com/asottile/babi/blob/d37d7d698d560aef7c6a0d1ec0668672e039bd9a/babi/screen.py#L501

--
nosy: +Anthony Sottile

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



[issue45847] Port module setup to PY_STDLIB_MOD() macro and addext()

2022-04-02 Thread Anthony Sottile


Anthony Sottile  added the comment:

this appears to break the tkinter extension for ubuntu bionic (18.04) -- I'm 
not entirely sure on the correct fix here but I get the following from trying 
to build there:

2022-04-02T15:52:08.0910452Z Python build finished successfully!
2022-04-02T15:52:08.0911924Z The necessary bits to build these optional modules 
were not found:
2022-04-02T15:52:08.0913469Z _tkinter


this is the tk I have available:

root@f0dd06a3e87c:/# dpkg -l | grep libtk
ii  libtk8.6:amd64   8.6.8-4 amd64  
  Tk toolkit for Tcl and X11 v8.6 - run-time files

--
nosy: +Anthony Sottile

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



[issue45847] Port module setup to PY_STDLIB_MOD() macro and addext()

2022-04-02 Thread Anthony Sottile


Anthony Sottile  added the comment:

the `tk-dev` package on ubuntu bionic does not ship with a `pkg-config` file 
for tk so it does not build properly there: 

```
root@f0dd06a3e87c:/cpython# dpkg -L tk8.6-dev | grep pc
root@f0dd06a3e87c:/cpython# 
```

(a note: bionic reaches end of life in april 2023 so it is likely to still see 
significant use until then)

--

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



[issue45847] Port module setup to PY_STDLIB_MOD() macro and addext()

2022-04-02 Thread Anthony Sottile


Anthony Sottile  added the comment:

I could, but it's very unlikely to get fixed given I believe 18.04 is in 
security-only fixes and backporting a pkg-config file seems unlikely

this worked two days ago before this patch

--

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



[issue45847] Port module setup to PY_STDLIB_MOD() macro and addext()

2022-04-04 Thread Anthony Sottile


Change by Anthony Sottile :


--
nosy:  -Anthony Sottile

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



[issue8243] curses writing to window's bottom right position raises: `_curses.error: addstr() returned ERR'

2019-08-13 Thread Anthony Sottile


Anthony Sottile  added the comment:

In case it helps someone else, `insstr` seems to not have this limitation

--
nosy: +Anthony Sottile

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



[issue20490] Show clear error message on circular import

2019-08-15 Thread Anthony Sottile


Change by Anthony Sottile :


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

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



[issue20490] Show clear error message on circular import

2019-08-15 Thread Anthony Sottile


Change by Anthony Sottile :


--
nosy: +Anthony Sottile
versions: +Python 3.8, Python 3.9 -Python 3.5

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



[issue37636] Deprecate slicing and ordering operations on sys.version

2019-08-24 Thread Anthony Sottile


Anthony Sottile  added the comment:

I threw together a flake8 plugin which checks for these usage patterns:

https://github.com/asottile/flake8-2020


| Code   | Description |
||-|
| YTT101 | `sys.version[:...]` referenced (python3.10) |
| YTT102 | `sys.version[2]` referenced (python3.10)|
| YTT201 | `sys.version_info[0] == 3` referenced (python4) |
| YTT202 | `six.PY3` referenced (python4)  |
| YTT301 | `sys.version[0]` referenced (python10)  |

--

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



[issue37995] Multiline ast.dump()

2019-08-31 Thread Anthony Sottile


Anthony Sottile  added the comment:

neat, this looks like a similar api to astpretty: 
https://github.com/asottile/astpretty

--
nosy: +Anthony Sottile

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



[issue36853] inconsistencies in docs builds (Sphinx 2)

2019-09-02 Thread Anthony Sottile


Change by Anthony Sottile :


--
pull_requests: +15320
pull_request: https://github.com/python/cpython/pull/15653

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



[issue38090] test_ctypes is leaking references

2019-09-10 Thread Anthony Sottile


Anthony Sottile  added the comment:

oops! thanks for the quick fix, I'll double check where I copied this from 
since it might have the same bug

--

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



[issue38090] test_ctypes is leaking references

2019-09-10 Thread Anthony Sottile


Anthony Sottile  added the comment:

https://github.com/python/cpython/pull/6398/files#diff-fb54fd281a2569006594f7edc6ad90f9R744

hmm I assume _PyDict_GetItemId has different reference semantics?

--

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



[issue38312] curses: add `set_tabsize` and `set_escdelay`

2019-09-28 Thread Anthony Sottile


New submission from Anthony Sottile :

https://linux.die.net/man/3/set_escdelay
https://linux.die.net/man/3/set_tabsize

I'd like to help with this, but I don't even know where to start with 
argumentclinic -- any points would be greatly appreciated

presumably I should also add getters for these as well to retrieve the global 
variable from the curses side?

--
components: Extension Modules
messages: 353477
nosy: Anthony Sottile
priority: normal
severity: normal
status: open
title: curses: add `set_tabsize` and `set_escdelay`
versions: Python 3.9

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



[issue38342] ImportError: cannot import name 'MetadataPathFinder' from 'importlib.metadata'

2019-10-01 Thread Anthony Tuininga


New submission from Anthony Tuininga :

Running the suggested code found at 
https://docs.python.org/3.8/whatsnew/3.8.html regarding the new 
importlib.metadata module

from importlib.metadata import version, requires, files
version('requests')

yields the error

Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/local/lib/python3.8/importlib/metadata/__init__.py", line 365, in 
version
return distribution(package).version
  File "/usr/local/lib/python3.8/importlib/metadata/__init__.py", line 338, in 
distribution
return Distribution.from_name(package)
  File "/usr/local/lib/python3.8/importlib/metadata/__init__.py", line 159, in 
from_name
dists = resolver(name)
  File "", line 1381, in 
find_distributions
ImportError: cannot import name 'MetadataPathFinder' from 'importlib.metadata' 
(/usr/local/lib/python3.8/importlib/metadata/__init__.py)

--
components: Library (Lib)
messages: 353714
nosy: atuining
priority: normal
severity: normal
status: open
title: ImportError: cannot import name 'MetadataPathFinder' from 
'importlib.metadata'
type: behavior
versions: Python 3.8

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



[issue38342] ImportError: cannot import name 'MetadataPathFinder' from 'importlib.metadata'

2019-10-02 Thread Anthony Tuininga


Anthony Tuininga  added the comment:

Yes. I had tried b3 earlier, installed b4 over b3 and then rc1 over b4. 
Removing the cruft using the command you specified caused the problem to go 
away.

--

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



[issue38570] Shlex does not parse commands containing single quotes correctly

2019-10-25 Thread Anthony Sottile


Anthony Sottile  added the comment:

Try with `sh`:

(it prompts for continuation, I pressed ^D to end it)

$ export F=$'\''
> 
> 
> 
> 
> sh: 8: Syntax error: Unterminated quoted string


dollar-sign strings are a `bash` extension, I don't think they're supported by 
*sh*lex (maybe if there was a bashlex module :D)

There's the `posix=False` option to `shlex.split` -- I'm not sure what it 
does/doesn't enable though (the docs aren't thorough here and the code is a bit 
non-obvious):

>>> shlex.split(s, posix=False)
['export', "F=$'\\''"]

--
nosy: +Anthony Sottile

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



[issue38312] curses: add `set_tabsize` and `set_escdelay`

2019-10-26 Thread Anthony Sottile


Change by Anthony Sottile :


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

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



[issue37330] open(): remove 'U' mode, deprecated since Python 3.3

2019-10-28 Thread Anthony Sottile


Anthony Sottile  added the comment:

should we backport a documentation change for this? (the deprecatedremoved says 
4.0 currently)

--
nosy: +Anthony Sottile

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



[issue38312] curses: add `set_tabsize` and `set_escdelay`

2019-10-29 Thread Anthony Sottile


Anthony Sottile  added the comment:

ah, I'll add those too -- I can do that in the current PR

--

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



[issue38737] StreamReaderProtocol.eof_received() should return True only for _SSLProtocolTransport

2019-11-07 Thread Anthony Baire


New submission from Anthony Baire :

We developed an alternate asyncio TLS transport based on GnuTLS 
(https://pypi.org/project/aio-gnutls-transport/). In this project we want to 
support half-closed TLS connections (WriteTransport.write_eof()).


Unfortunately StreamReaderProtocol won't interoperate properly without a monkey 
patch because its eof_received() method returns True for any ssl transport 
(this is to avoid a warning in the _SSLProtocolTransport):

def eof_received(self):
self._stream_reader.feed_eof()
if self._over_ssl:
# Prevent a warning in SSLProtocol.eof_received:
# "returning true from eof_received()
# has no effect when using ssl"
return False
return True

As this is an unspecified internal feature, very specific to the 
_SSLProtocolTransport class (which issues the warning), we think the test 
should be made explicitly against this class (see the attached patch).

--
components: asyncio
files: eof-received-over-ssl.diff
keywords: patch
messages: 356207
nosy: aba, asvetlov, yselivanov
priority: normal
severity: normal
status: open
title: StreamReaderProtocol.eof_received() should return True only for 
_SSLProtocolTransport
type: behavior
versions: Python 3.7, Python 3.8, Python 3.9
Added file: https://bugs.python.org/file48701/eof-received-over-ssl.diff

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



[issue8978] "tarfile.ReadError: file could not be opened successfully" if compiled without zlib

2021-03-13 Thread Anthony Sottile


Change by Anthony Sottile :


--
nosy: +Anthony Sottile
nosy_count: 7.0 -> 8.0
pull_requests: +23611
pull_request: https://github.com/python/cpython/pull/24850

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



[issue8978] "tarfile.ReadError: file could not be opened successfully" if compiled without zlib

2021-03-15 Thread Anthony Sottile


Anthony Sottile  added the comment:

I took a stab at improving the error message (see the linked PR)

$ ./python -c 'import tarfile; tarfile.open("Lib/test/testtar.tar.xz")'
Traceback (most recent call last):
  File "", line 1, in 
  File "/home/asottile/workspace/cpython/Lib/tarfile.py", line 1620, in open
raise ReadError(f"file could not be opened successfully:\n{error_msgs}")
tarfile.ReadError: file could not be opened successfully:
- method gz: ReadError('not a gzip file')
- method bz2: CompressionError('bz2 module is not available')
- method xz: CompressionError('lzma module is not available')
- method tar: ReadError('truncated header')

--

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



[issue43614] Search is not beginner friendly

2021-03-24 Thread Anthony Flury


New submission from Anthony Flury :

A commonly asked question on Quora is 'What do *args and **kwargs' mean ?

While it is relatively easy for community to answer these questions the search 
tool on the standard documentation doesn't make it easy.

I understand that 'args' and 'kwargs' are both naming conventions, they are 
very common across the documentation, but searching on '*args' or '**kwargs' 
doesn't actually find anything useful - it certainly doesn't place 
'https://docs.python.org/3/tutorial/controlflow.html#arbitrary-argument-lists' 
at or close to the top of the list.

It is my view that the documentation should be beginner friendly, but in this 
case (and many other I guess) you have to know what to search for to find 
something useful.

I note that even common phrases in Computing (such as 'variable arguments' or 
'variable parameters') don't find anything useful. The term 'variadic' does 
find the relevant page, but the link displayed in the search results lands on 
the page (but not the relevant section) - and many beginners wont search for 
'variadic'.

The index and search need to be improved to help beginners - specifically in 
this case
* Search Index should include common conventional names (such as args, kwargs)
* Search Index should include common computing terms ('variable arguments' for 
example - even if the documentation doesn't actually use that terminology).
* Search should link to the relevant section (and not just the page).

--
assignee: docs@python
components: Documentation
messages: 389442
nosy: anthony-flury, docs@python
priority: normal
severity: normal
status: open
title: Search is not beginner friendly
versions: Python 3.9

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



[issue43614] Search is not beginner friendly

2021-03-27 Thread Anthony Flury


Anthony Flury  added the comment:

Is PR 25045 the correct Pull request - this Issue is a documentation change - 
the linked PR is related to Issue 43433 (a change to xmlrpc.client ?)

--

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



[issue43567] regen.vcxproj cannot regenerate some necessary files

2021-03-31 Thread anthony shaw


anthony shaw  added the comment:

Guido, regen.vcxproj targets 142 as the SDK version, which is most likely a 
mistake.
The other projects are part of the main PCBuild.sln solution, which has a 
variable for the base SDK version.

If you need to change it quickly, you can either open it in VS and right click 
on the project and change the properties to an older SDK, or edit the vcxproj 
file itself.

I can make this change in a patch, but because its a standalone project, it 
doesn't share the base SDK version with the others.

I've reviewed Steve's patch and it would fix this because it changes regen into 
a build target instead of a build project, so it doesn't specify the SDK 
version at all.
Steve's implementation is also much, much cleaner!

--
nosy: +anthony shaw

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



[issue43737] Documentation of modulo operator should document behaviour clearly when second operator is negative

2021-04-05 Thread Anthony Flury


New submission from Anthony Flury :

The behavior of a%b when a is positive and b is negative can be suprising. 

I understand that the behavior is so that the identity 

a = (a//b)*b + a%b 

can be preserved regardless of the signs of a or b.

but the result is different from other languages which is why it can be 
surprising.

I would be happy to do the grunt work to make the changes if some can suggest 
where.

Do we - add a warning to the 
https://docs.python.org/3/tutorial/introduction.html#numbers page, or should we 
link to a new page that details and explains the behavior. Which is more 
'pythonic' in terms of documentation ?

--
messages: 390264
nosy: anthony-flury
priority: normal
severity: normal
status: open
title: Documentation of modulo operator should document behaviour clearly when 
second operator is negative

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



[issue43737] Documentation of modulo operator should document behaviour clearly when second operator is negative

2021-04-06 Thread Anthony Flury


Anthony Flury  added the comment:

I take your point about warnings etc - but when you come from other languages 
the Python behavior can initially be very surprising.

The reference section has always seemed to be a very technical document, 
certainly not targeted at the usual audience of people using Python.

Most Python users don't consider that int/float etc would be in the standard 
library either - for most users the built-ins are not the same.

Can I suggest:

1) The identity that is mentioned on 
https://docs.python.org/3/reference/expressions.html#binary-arithmetic-operations
 should be made more clear - at the moment it is buried in a paragraph and 
easily missed.

2) The document 
https://docs.python.org/3/library/stdtypes.html#numeric-types-int-float-complex 
should also mention the identity and the need to preserve it.

3) A link fromhttps://docs.python.org/3/tutorial/introduction.html#numbers to 
the document 
https://docs.python.org/3/library/stdtypes.html#numeric-types-int-float-complex 
- the introductory tutorial should link to further detail where neccessary.

--

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



[issue43325] Documentation should warn that 'is' is not a safe comparison operator for most values.

2021-04-06 Thread Anthony Flury


Anthony Flury  added the comment:

Should the data structures page also link to the FAQ. The problem with the FAQ 
is that most beginners don't even know that == vs 'is' is actually a question 
they need to ask, and therefore they aren't likely to look at the FAQ in the 
first place.

--

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



[issue43737] Documentation of modulo operator should document behaviour clearly when second operator is negative

2021-04-06 Thread Anthony Flury


Anthony Flury  added the comment:

I am working on a pull request for this.

--

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



[issue43737] Documentation of modulo operator should document behaviour clearly when second operator is negative

2021-04-06 Thread Anthony Flury


Change by Anthony Flury :


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

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



[issue43737] Documentation of modulo operator should document behaviour clearly when second operator is negative

2021-04-08 Thread Anthony Flury


Change by Anthony Flury :


--
pull_requests: +24015
pull_request: https://github.com/python/cpython/pull/25279

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



[issue43737] Documentation of modulo operator should document behaviour clearly when second operator is negative

2021-04-08 Thread Anthony Flury


Change by Anthony Flury :


--
type:  -> enhancement

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



[issue43737] Documentation of modulo operator should document behaviour clearly when second operator is negative

2021-04-08 Thread Anthony Flury


Change by Anthony Flury :


--
assignee:  -> docs@python
components: +Documentation
nosy: +docs@python

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



[issue43782] Failure to build from source on ppc64le on ubuntu xenial

2021-04-08 Thread Anthony Sottile


New submission from Anthony Sottile :

I realize this is unlikely to be a helpful report, but something that changed 
between 3.9.3 and 3.9.4 has caused the build to break on (admittedly a strange 
platform) ppc64le


I attached the build log (zipped because otherwise it's too big ?)

The live URL is here: 
https://launchpadlibrarian.net/532585040/buildlog_ubuntu-xenial-ppc64el.python3.9_3.9.4-1+xenial1_BUILDING.txt.gz

Probably the most relevant part of the bug report is this bit, though I'm 
guessing so I don't really know what is useful and what is not.

```
Preprocessed source stored into /tmp/ccIkITd0.out file, please attach this to 
your bugreport.
=== BEGIN GCC DUMP ===
// Target: powerpc64le-linux-gnu
// Configured with: ../src/configure -v --with-pkgversion='Ubuntu/IBM 
5.4.0-6ubuntu1~16.04.12' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs 
--enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr 
--program-suffix=-5 --enable-shared --enable-linker-build-id 
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix 
--libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu 
--enable-libstdcxx-debug --enable-libstdcxx-time=yes 
--with-default-libstdcxx-abi=new --enable-gnu-unique-object 
--disable-libquadmath --enable-plugin --with-system-zlib 
--disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo 
--with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-ppc64el/jre --enable-java-home 
--with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-ppc64el 
--with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-ppc64el 
--with-arch-directory=ppc64le --with-ecj-jar=/usr/share/java/eclipse-ecj.jar 
--enable-objc-gc --enable-secureplt --with-cpu=power8 --ena
 ble-targets=powerpcle-linux --disable-multilib --enable-multiarch 
--disable-werror --with-long-double-128 --enable-checking=release 
--build=powerpc64le-linux-gnu --host=powerpc64le-linux-gnu 
--target=powerpc64le-linux-gnu
// Thread model: posix
// gcc version 5.4.0 20160609 (Ubuntu/IBM 5.4.0-6ubuntu1~16.04.12) 
// 
// ../Python/ceval.c: In function 'is_tstate_valid':
// ../Python/ceval.c:5694:1: internal compiler error: Segmentation fault
//  }
//  ^
// Please submit a full bug report,
// with preprocessed source if appropriate.
// See  for instructions.
```

--
components: Build
files: buildlog.tgz
messages: 390580
nosy: Anthony Sottile
priority: normal
severity: normal
status: open
title: Failure to build from source on ppc64le on ubuntu xenial
versions: Python 3.9
Added file: https://bugs.python.org/file49946/buildlog.tgz

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



[issue43782] Failure to build from source on ppc64le on ubuntu xenial

2021-04-08 Thread Anthony Sottile


Anthony Sottile  added the comment:

hmmm strange, the only changes in 3.9.4 are a revert -- perhaps this is a 
flakey bug in gcc and not actionable

I've clicked rebuild on my build, maybe it'll magically fix it

plus xenial is almost end of lifed so I doubt anyone cares about this strange 
architecture on an old platform anyway

--

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



[issue43737] Documentation of modulo operator should document behaviour clearly when second operator is negative

2021-04-09 Thread Anthony Flury


Anthony Flury  added the comment:

I fundamentally disagree with closing this - I know that this and many other 
'quirks' catch beginners out, and the tutorial is what they use to learn.They 
don't look in the reference document - it is too dense in BNF definitions which 
turns a lot of people off from any other useful information - When I was 
researching this issue I didn't even think to look in the reference section.

Looking in the library section for information about the built-in types is also 
non-obvious to beginners. 

If the tutorial doesn't contain the detail, and doesn't link to the detail then 
beginners are left entirely puzzled by the behavior.

Given how difficult it is to search the documentation if you don't know exactly 
what you are looking for, then how beginners would know to look at the FAQ is 
beyond me. Having communicated with a number of beginners on a number of issues 
they had no idea that the FAQ even existed.

The change didn't 'bury the tutorial in detail' - it added once sentence which 
linked to the FAQ. In fact all the change did was expand the FAQ entry by a few 
lines and link to the FAQ from the three places that are relevant.

I think this is a small change and it should be the start of making the 
tutorial beginner friendly.

--
resolution: not a bug -> 
status: closed -> open

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



[issue43833] Unexpected Parsing of Numeric Literals Concatenated with Boolean Operators

2021-04-13 Thread Anthony Sottile


Anthony Sottile  added the comment:

here's quite a few other cases as well -- I'd love for this to be clarified in 
PEP8 such that I can rationalize crafting a rule for it in `pycodestyle` -- 
https://github.com/PyCQA/pycodestyle/issues/371

--
nosy: +Anthony Sottile

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



[issue43782] Failure to build from source on ppc64le on ubuntu xenial

2021-04-15 Thread Anthony Sottile


Anthony Sottile  added the comment:

a rebuild succeeded so I'm ok closing this :shrug:

--
stage:  -> resolved
status: pending -> closed

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



[issue43933] Regression in python3.10 with traceback frame having lineno of -1

2021-04-24 Thread Anthony Sottile


New submission from Anthony Sottile :

This is breaking pytest for failed assertions: 
https://github.com/pytest-dev/pytest/pull/8227

It also breaks the traceback in the output below

Here's a minimal example:

```python
class Boom:
def __enter__(self):
return self
def __exit__(self, *_):
raise AssertionError('boom!')


def main() -> int:
with Boom():
raise AssertionError('hi')


if __name__ == '__main__':
exit(main())
```

On python3.9 you get this:

```
Traceback (most recent call last):
  File "/home/asottile/workspace/cpython/t.py", line 10, in main
raise AssertionError('hi')
AssertionError: hi

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/asottile/workspace/cpython/t.py", line 14, in 
exit(main())
  File "/home/asottile/workspace/cpython/t.py", line 10, in main
raise AssertionError('hi')
  File "/home/asottile/workspace/cpython/t.py", line 5, in __exit__
raise AssertionError('boom!')
AssertionError: boom!
```

output in python3.10:

```
Traceback (most recent call last):
  File "/home/asottile/workspace/cpython/t.py", line 10, in main
raise AssertionError('hi')
AssertionError: hi

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/asottile/workspace/cpython/t.py", line 14, in 
exit(main())
  File "/home/asottile/workspace/cpython/t.py", line -1, in main
  File "/home/asottile/workspace/cpython/t.py", line 5, in __exit__
raise AssertionError('boom!')
AssertionError: boom!
```

Notice the second to last frame is now missing and invalid (line -1)

I bisected this and found this is the culprit:


https://github.com/python/cpython/commit/3bd6035b6baf1a7d51b7cc2c6bb2c81886236b67
https://github.com/python/cpython/pull/24202

```
3bd6035b6baf1a7d51b7cc2c6bb2c81886236b67 is the first bad commit
commit 3bd6035b6baf1a7d51b7cc2c6bb2c81886236b67
Author: Mark Shannon 
Date:   Wed Jan 13 12:05:43 2021 +

bpo-42908: Mark cleanup code at end of try-except and with artificial 
(#24202)

* Mark bytecodes at end of try-except as artificial.

* Make sure that the CFG is consistent throughout optimiization.

* Extend line-number propagation logic so that implicit returns after 
'try-except' or 'with' have the correct line numbers.

* Update importlib

 Lib/test/test_dis.py  |2 +-
 Lib/test/test_sys_settrace.py |   40 +
 Python/compile.c  |  135 +-
 Python/importlib.h| 3153 ++---
 Python/importlib_external.h   | 4489 -
 Python/importlib_zipimport.h  | 1013 +-
 6 files changed, 4473 insertions(+), 4359 deletions(-)
bisect run success
```

which appears to be due to bpo-42908

--
messages: 391795
nosy: Anthony Sottile, Mark.Shannon, pablogsal
priority: normal
severity: normal
status: open
title: Regression in python3.10 with traceback frame having lineno of -1
versions: Python 3.10, Python 3.11

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



[issue38605] [typing] PEP 563: Postponed evaluation of annotations: enable it by default in Python 3.11

2021-04-25 Thread Anthony Sottile


Change by Anthony Sottile :


--
nosy: +Anthony Sottile
nosy_count: 14.0 -> 15.0
pull_requests: +24316
stage: resolved -> patch review
pull_request: https://github.com/python/cpython/pull/25596

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



[issue43933] Regression in python3.10 with traceback frame having lineno of -1

2021-04-30 Thread Anthony Sottile


Anthony Sottile  added the comment:

can confirm that pytest no longer crashes

--

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



[issue43994] change representation of match as / capture as `Name(..., ctx=Store())`

2021-04-30 Thread Anthony Sottile


New submission from Anthony Sottile :

I'm looking at adding support to `match` for pyflakes, and the first impression 
I have is that `MatchAs` is unnecessarily different from `Name` with 
`ctx=Store()`

if it were represented as the latter pyflakes would not require special 
handling of `match`, it would work the same as the current code

I suspect other static analysis tools would benefit from a change as well

--
messages: 392531
nosy: Anthony Sottile
priority: normal
severity: normal
status: open
title: change representation of match as / capture as `Name(..., ctx=Store())`
versions: Python 3.10

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



[issue43994] change representation of match as / capture as `Name(..., ctx=Store())`

2021-04-30 Thread Anthony Sottile


Anthony Sottile  added the comment:

I'm suggesting instead of:

MatchAs(pattern=None, name='foo')

to have

MatchAs(pattern=None, name=Name('foo', ctx=Store()))

--

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



[issue43994] change representation of match as / capture as `Name(..., ctx=Store())`

2021-04-30 Thread Anthony Sottile


Anthony Sottile  added the comment:

and actually, now that I look close it would be useful for `MatchStar` and 
`MatchMapping` to also use a `Name(..., ctx=Store())` for their respective 
parameters as well

--

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



[issue43994] change representation of match as / capture as `Name(..., ctx=Store())`

2021-04-30 Thread Anthony Sottile


Anthony Sottile  added the comment:

at least for static analysis of other python constructs it's very convenient to 
know from a `Name` node alone whether it's being used in a read or write 
context -- without this information an ast traversal needs to maintain more 
information about whether it's a read or write context

for pyflakes this is especially important as it needs to know what names are 
defined in scope (and referenced in scope) to produce diagnostic messages

for other tools like `dead` / `vulture` it's useful to identify introduced and 
referenced names similarly

the `as` in `with` does and the target for assignment expressions so I would 
expect the similar constructs in `match` to do so as well

`Name` nodes are also useful for better diagnostic messages as they contain 
positioning information, which isn't easily extracted from `MatchAs`, etc. -- 
if I recall correctly, the `asname` for imports was recently extended to add 
this information for the same purpose

--

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



[issue43933] Regression in python3.10 with traceback frame having lineno of -1

2021-05-01 Thread Anthony Sottile


Anthony Sottile  added the comment:

ah yeah that's the `asname` ast change -- if you use the unreleased main branch 
it has a fix for that

--

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



[issue40465] Deprecate the optional *random* argument to random.shuffle()

2021-05-03 Thread Anthony Sottile


Change by Anthony Sottile :


--
nosy:  -Anthony Sottile

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



[issue43933] Regression in python3.10 with traceback frame having lineno of -1

2021-05-04 Thread Anthony Sottile


Anthony Sottile  added the comment:

I've released pytest 6.2.4 for the other breakage (which is unrelated to this 
bpo -- it was the asname source position issue)

--

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



  1   2   3   4   5   6   7   8   >