[issue3508] range() is not a generator when used in for's

2008-08-05 Thread Diego

New submission from Diego <[EMAIL PROTECTED]>:

Hi.

I am a debian lenny user so i am still using python 2.5 so i dont know 
how is this "bug" working on newer pythons. Please close it if you find 
that it doesnt exists.

It may not be a bug but.

I have maked an script to optimice minterms sums (This is electronics 
stuff to reduce the number of logic devices in an electronic design).
The algorithm depends exponentially on the number of bits in the input 
and the output. So to test it i have to generate 2**N_input_bits 
strings in a list. Each string being of N_input_bits+N_output_bits long.

The problem starts when N_input_bits is too much long. (from 25 and up)
The function range(2**N_input_bits) instantiates a list with all thoose 
numbers.

I have maked a test script to check it out:

import time

N=32

try:
  range(2**N)
  # range(): allocates N's integer's items in a list
except Exception, error:
  print "ERROR: ",error, "   Items=",N
  print

time.sleep(10)

def RANGE(a):
  # GENERATOR: Creates one output eachtime it is called.
  i=0
  while i
<http://bugs.python.org/issue3508>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3508] range() is not a generator when used in for's

2008-08-06 Thread Diego

Diego <[EMAIL PROTECTED]> added the comment:

2008/8/6 Mark Dickinson <[EMAIL PROTECTED]>:
>
> Mark Dickinson <[EMAIL PROTECTED]> added the comment:
>
> By the way, do you already know about xrange?
>
> xrange([start,] stop[, step]) -> xrange object
>
> Like range(), but instead of returning a list, returns an object that
> generates the numbers in the range on demand.  For looping, this is
> slightly faster than range() and more memory efficient.
>
> ___
> Python tracker <[EMAIL PROTECTED]>
> <http://bugs.python.org/issue3508>
> ___
>

Traceback (most recent call last):
  File "", line 1, in 
OverflowError: long int too large to convert to int

4294967296L

Traceback (most recent call last):
  File "", line 1, in 
OverflowError: range() result has too many items

Sadly so high numbers are longs and xrange seems to get an integer.

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



[issue3508] range() is not a generator when used in for's

2008-08-06 Thread Diego

Diego <[EMAIL PROTECTED]> added the comment:

>>> a = xrange(2**32)
Traceback (most recent call last):
 File "", line 1, in 
OverflowError: long int too large to convert to int

>>> 2**32
4294967296L

>>> a=range(2**32)
Traceback (most recent call last):
 File "", line 1, in 
OverflowError: range() result has too many items



Sadly so high numbers are longs and xrange seems to get an integer.

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



[issue1663] Modification HTMLParser.py

2007-12-19 Thread diego

New submission from diego:

Hello my name is Diego, I needed to parse HTML to retrieve only text,
but not grasped how to do it with class HTMLParser, so the change to do
it. The code to use is:
class ParsearHTML (HTMLParser.HTMLParser):

def __init__(self,datos):
HTMLParser.HTMLParser.__init__(self)
self.feed(datos)
self.close()

def handle_data(self,data):
return data

parser  = ParsearHTML(onTmp)
data = parser.feed(onTmp)
And changes in the class are attached. Thank you very much. Diego.

--
components: None
files: HTMLParser.py
messages: 58821
nosy: diegorubenarias
severity: normal
status: open
title: Modification HTMLParser.py
type: resource usage
versions: Python 2.4
Added file: http://bugs.python.org/file9000/HTMLParser.py

__
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1663>
__"""A parser for HTML and XHTML."""

# This file is based on sgmllib.py, but the API is slightly different.

# XXX There should be a way to distinguish between PCDATA (parsed
# character data -- the normal case), RCDATA (replaceable character
# data -- only char and entity references and end tags are special)
# and CDATA (character data -- only end tags are special).


import markupbase
import re

# Regular expressions used for parsing

interesting_normal = re.compile('[&<]')
interesting_cdata = re.compile(r'<(/|\Z)')
incomplete = re.compile('&[a-zA-Z#]')

entityref = re.compile('&([a-zA-Z][-.a-zA-Z0-9]*)[^a-zA-Z0-9]')
charref = re.compile('&#(?:[0-9]+|[xX][0-9a-fA-F]+)[^0-9a-fA-F]')

starttagopen = re.compile('<[a-zA-Z]')
piclose = re.compile('>')
commentclose = re.compile(r'--\s*>')
tagfind = re.compile('[a-zA-Z][-.a-zA-Z0-9:_]*')
attrfind = re.compile(
r'\s*([a-zA-Z_][-.:a-zA-Z_0-9]*)(\s*=\s*'
r'(\'[^\']*\'|"[^"]*"|[-a-zA-Z0-9./,:;+*%?!&$\(\)[EMAIL PROTECTED]))?')

locatestarttagend = re.compile(r"""
  <[a-zA-Z][-.a-zA-Z0-9:_]*  # tag name
  (?:\s+ # whitespace before attribute name
(?:[a-zA-Z_][-.:a-zA-Z0-9_]* # attribute name
  (?:\s*=\s* # value indicator
(?:'[^']*'   # LITA-enclosed value
  |\"[^\"]*\"# LIT-enclosed value
  |[^'\">\s]+# bare value
 )
   )?
 )
   )*
  \s*# trailing whitespace
""", re.VERBOSE)
endendtag = re.compile('>')
endtagfind = re.compile('')


class HTMLParseError(Exception):
"""Exception raised for all parse errors."""

def __init__(self, msg, position=(None, None)):
assert msg
self.msg = msg
self.lineno = position[0]
self.offset = position[1]

def __str__(self):
result = self.msg
if self.lineno is not None:
result = result + ", at line %d" % self.lineno
if self.offset is not None:
result = result + ", column %d" % (self.offset + 1)
return result


class HTMLParser(markupbase.ParserBase):
"""Find tags and other markup and call handler functions.

Usage:
p = HTMLParser()
p.feed(data)
...
p.close()

Start tags are handled by calling self.handle_starttag() or
self.handle_startendtag(); end tags by self.handle_endtag().  The
data between tags is passed from the parser to the derived class
by calling self.handle_data() with the data as argument (the data
may be split up in arbitrary chunks).  Entity references are
passed by calling self.handle_entityref() with the entity
reference as the argument.  Numeric character references are
passed to self.handle_charref() with the string containing the
reference as the argument.
"""

CDATA_CONTENT_ELEMENTS = ("script", "style")


def __init__(self):
"""Initialize and reset this instance."""
self.reset()

def reset(self):
"""Reset this instance.  Loses all unprocessed data."""
self.rawdata = ''
self.lasttag = '???'
self.interesting = interesting_normal
markupbase.ParserBase.reset(self)

"""
Ultima Modificacion: Diego Arias 18/12/07
El metodo feed antiguamente no retornaba valor,
ahora devuelve 'data' en donde se encuentra el
texto sin tags html
"""

def feed(self, data):
"""Feed data to the parser.

Call 

[issue1663] Modification HTMLParser.py

2007-12-19 Thread diego

diego added the comment:

-- Forwarded message --
From: diego <[EMAIL PROTECTED]>
Date: 19-dic-2007 17:05
Subject: [issue1663] Modification HTMLParser.py
To: [EMAIL PROTECTED]

New submission from diego:

Hello my name is Diego, I needed to parse HTML to retrieve only text,
but not grasped how to do it with class HTMLParser, so the change to do
it. The code to use is:
class ParsearHTML (HTMLParser.HTMLParser):

def __init__(self,datos):
HTMLParser.HTMLParser.__init__(self)
self.feed(datos)
self.close()

def handle_data(self,data):
return data

parser  = ParsearHTML(onTmp)
data = parser.feed(onTmp)
And changes in the class are attached. Thank you very much. Diego.

--
components: None
files: HTMLParser.py
messages: 58821
nosy: diegorubenarias
severity: normal
status: open
title: Modification HTMLParser.py
type: resource usage
versions: Python 2.4
Added file: http://bugs.python.org/file9000/HTMLParser.py

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

Added file: http://bugs.python.org/file9002/unnamed
Added file: http://bugs.python.org/file9003/HTMLParser.py

__
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1663>
__-- Forwarded message --From: diego <mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]>Date: 19-dic-2007 
17:05
Subject: [issue1663] Modification HTMLParser.pyTo: mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]New 
submission from diego:Hello my name is Diego, I needed to parse HTML to 
retrieve only text,
but not grasped how to do it with class HTMLParser, so the change to 
doit. The code to use is:class ParsearHTML 
(HTMLParser.HTMLParser):def 
__init__(self,datos):HTMLParser.HTMLParser.__init_
_(self)self.feed(datos)self.close()def
 
handle_data(self,data):return
 dataparser  = ParsearHTML(onTmp)data = 
parser.feed(onTmp)And changes in the class are attached. Thank you very 
much. Diego.
--components: Nonefiles: HTMLParser.pymessages: 
58821nosy: diegorubenariasseverity: normalstatus: opentitle: 
Modification HTMLParser.pytype: resource usageversions: Python 
2.4Added file: http://bugs.python.org/file9000/HTMLParser.py";>http://bugs.python.org/file9000/HTMLParser.py__Tracker
 <mailto:[EMAIL PROTECTED]">
[EMAIL PROTECTED]><http://bugs.python.org/issue1663";>http://bugs.python.org/issue1663>__

"""A parser for HTML and XHTML."""

# This file is based on sgmllib.py, but the API is slightly different.

# XXX There should be a way to distinguish between PCDATA (parsed
# character data -- the normal case), RCDATA (replaceable character
# data -- only char and entity references and end tags are special)
# and CDATA (character data -- only end tags are special).


import markupbase
import re

# Regular expressions used for parsing

interesting_normal = re.compile('[&<]')
interesting_cdata = re.compile(r'<(/|\Z)')
incomplete = re.compile('&[a-zA-Z#]')

entityref = re.compile('&([a-zA-Z][-.a-zA-Z0-9]*)[^a-zA-Z0-9]')
charref = re.compile('&#(?:[0-9]+|[xX][0-9a-fA-F]+)[^0-9a-fA-F]')

starttagopen = re.compile('<[a-zA-Z]')
piclose = re.compile('>')
commentclose = re.compile(r'--\s*>')
tagfind = re.compile('[a-zA-Z][-.a-zA-Z0-9:_]*')
attrfind = re.compile(
r'\s*([a-zA-Z_][-.:a-zA-Z_0-9]*)(\s*=\s*'
r'(\'[^\']*\'|"[^"]*"|[-a-zA-Z0-9./,:;+*%?!&$\(\)[EMAIL PROTECTED]))?')

locatestarttagend = re.compile(r"""
  <[a-zA-Z][-.a-zA-Z0-9:_]*  # tag name
  (?:\s+ # whitespace before attribute name
(?:[a-zA-Z_][-.:a-zA-Z0-9_]* # attribute name
  (?:\s*=\s* # value indicator
(?:'[^']*'   # LITA-enclosed value
  |\"[^\"]*\"# LIT-enclosed value
  |[^'\">\s]+# bare value
 )
   )?
 )
   )*
  \s*# trailing whitespace
""", re.VERBOSE)
endendtag = re.compile('>')
endtagfind = re.compile('')


class HTMLParseError(Exception):
"""Exception raised for all parse errors."""

def __init__(self, msg, position=(None, None)):
assert msg
self.msg = msg
self.lineno = position[0]
self.offset = position[1]

def __str__(self):
result = self.msg
if self.lineno is not None:
result = result + ", at line %d" % se

[issue9218] pop multiple elements of a list at once

2010-07-11 Thread Diego

Diego  added the comment:

Help me. I cant find this list. I guessed that it would be a part of
the issue tracker and someone would label it right.

2010/7/11 Éric Araujo :
>
> Changes by Éric Araujo :
>
>
> --
> nosy: +merwok
>
> ___
> Python tracker 
> <http://bugs.python.org/issue9218>
> ___
>

--
nosy: +epsilon_da

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



[issue46381] Improve documentation of CFLAGS_NODIST, LDFLAGS_NODIST

2022-01-16 Thread Diego Ramirez


Change by Diego Ramirez :


--
nosy: +DiddiLeija

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



[issue46572] Unicode identifiers not necessarily unique

2022-01-29 Thread Diego Argueta

New submission from Diego Argueta :

The way Python 3 handles identifiers containing mathematical characters appears 
to be broken. I didn't test the entire range of U+1D400 through U+1D59F but I 
spot-checked them and the bug manifests itself there:

Python 3.9.7 (default, Sep 10 2021, 14:59:43) 
[GCC 11.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.

>>> foo = 1234567890
>>> bar = 1234567890
>>> foo is bar
False
>>> 𝖇𝖆𝖗 = 1234567890

>>> foo is 𝖇𝖆𝖗
False
>>> bar is 𝖇𝖆𝖗
True

>>> 𝖇𝖆𝖗 = 0
>>> bar
0


This differs from the behavior with other non-ASCII characters. For example, 
ASCII 'a' and Cyrillic 'a' are properly treated as different identifiers:

>>> а = 987654321# Cyrillic lowercase 'a', U+0430
>>> a = 123456789# ASCII 'a'
>>> а# Cyrillic
987654321
>>> a# ASCII
123456789


While a bit of a pathological case, it is a nasty surprise. It's possible this 
is a symptom of a larger bug in the way identifiers are resolved.

This is similar but not identical to https://bugs.python.org/issue46555

Note: I did not find this myself; I give credit to Cooper Stimson 
(https://github.com/6C1) for finding this bug. I merely reported it.

--
components: Parser, Unicode
messages: 412084
nosy: da, ezio.melotti, lys.nikolaou, pablogsal, vstinner
priority: normal
severity: normal
status: open
title: Unicode identifiers not necessarily unique
type: behavior
versions: Python 3.7, Python 3.8, Python 3.9

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



[issue46572] Unicode identifiers not necessarily unique

2022-01-29 Thread Diego Argueta


Diego Argueta  added the comment:

I did read PEP-3131 before posting this but I still thought the behavior was 
counterintuitive.

--

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



[issue33436] Add an interactive shell for Sqlite3

2022-02-11 Thread Diego Ramirez


Diego Ramirez  added the comment:

Do we still want to do this? See 
https://discuss.python.org/t/titling-sqlite3-table-columns-with-number/13656/3.

--
nosy: +DiddiLeija
versions: +Python 3.10, Python 3.11, Python 3.9

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



[issue8087] Unupdated source file in traceback

2011-10-05 Thread Diego Mascialino

Diego Mascialino  added the comment:

I worked a few hours today and I have this patch.
I tried to make a test but could not.

I know this is not a really good patch, but it's my first one and I wanted to 
show my idea.

--
keywords: +patch
versions:  -Python 2.7
Added file: http://bugs.python.org/file23321/issue8087.patch

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



[issue8087] Unupdated source file in traceback

2011-10-08 Thread Diego Mascialino

Diego Mascialino  added the comment:

On Fri, Oct 7, 2011 at 5:25 PM, Ezio Melotti  wrote:
>
> Ezio Melotti  added the comment:
>
> I'm not sure this is useful to have.  If you changed your code you know that 
> you have to reload, so why would you want a warning that tells you that you 
> changed the code?

The source line showed in the traceback could not be the same line
executed.

Take a look to this example:

k.py:
def f():
a,b,c = 1,2

Traceback (most recent call last):
  File "", line 1, in 
  File "k.py", line 2, in f
a,b,c = 1,2
ValueError: need more than 2 values to unpack

k.py:
def f():
# blah
a,b = 1,2

Traceback (most recent call last):
  File "", line 1, in 
  File "k.py", line 2, in f
# blah
ValueError: need more than 2 values to unpack

> For some reason I always had the opposite problem (i.e. after a reload the 
> traceback was still showing the original code, and not the new one), while 
> IIUC you are saying that it shows the new code even if the module is not 
> reloaded.
> I tried your code and indeed it does what you say, so either I am mistaken 
> and I've been misreading the tracebacks, or this changed from 2.6 to 2.7, or 
> in some cases even the behavior (I think) I observed might happen.
> I'll have to verify this next time it happens.

That is strange, I think Python does not save the original code in any place.

--

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



[issue8087] Unupdated source file in traceback

2011-10-08 Thread Diego Mascialino

Diego Mascialino  added the comment:

> So to me, your warning will only be useful in the case where I modified the 
> source, forgot to reload and got the same error again with a wrong line 
> displayed. Also note that reloading is not so common; usually you just 
> restart your application and that will give you the right traceback.

I know the case when this happens is really unsusual, but the
interperter could be able to alert you than that line of the traceback
is wrong.

> Also I'm not sure the warning you proposed is the best way to handle this.

I agree that, another approach is to save a copy of the source file
associated to the compiled code (like a .pys).

--

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



[issue10948] Trouble with dir_util created dir cache

2011-01-19 Thread Diego Queiroz

New submission from Diego Queiroz :

There is a problem with dir_util cache (defined by "_path_created" global 
variable).

It appears to be useful but it isn't, just repeat these steps to understand the 
problem I'm facing:

1) Use mkpath to create any path (eg. /home/user/a/b/c)
2) Open the terminal and manually delete the directory "/home/user/a" and its 
contents
3) Try to create "/home/user/a/b/c" again using mkpath

Expected behavior:
mkpath should create the folder tree again.

What happens:
Nothing, mkpath "thinks" the folder already exists because its creation was 
cached. Moreover, if you try to create one more folder level (eg. 
/home/user/a/b/c/d) it raises an exception because it thinks that part of the 
tree was already created and fails to create the last folder.


I'm working with parallel applications that deal with files asynchronously, 
this problem gave me a headache.

Anyway, the solution is easy: remove the cache.

--
assignee: tarek
components: Distutils
messages: 126540
nosy: diegoqueiroz, eric.araujo, tarek
priority: normal
severity: normal
status: open
title: Trouble with dir_util created dir cache
type: behavior
versions: Python 2.5, Python 2.6, Python 2.7, Python 3.1

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



[issue10948] Trouble with dir_util created dir cache

2011-01-19 Thread Diego Queiroz

Diego Queiroz  added the comment:

Well. My application does not actually randomly remove the folders, it just 
can't guarantee for a given process how the folder it created will be deleted.

I have many tasks running on a cluster using the same disk. Some tasks creates 
the folders/files and some of them remove them after processing. What each task 
will do depends of the availability of computational resources.

The application is also aware of possible user interaction, that is, I need to 
be able to manipulate folders manually (adding or removing) without crashing 
the application or corrupting data.

--

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



[issue10948] Trouble with dir_util created dir cache

2011-01-19 Thread Diego Queiroz

Diego Queiroz  added the comment:

Suppose the application creates one folder and add some data to it:

- /scratch/a/b/c

While the application is still running (it is not using the folder anymore), 
you see the data, copy it to somewhere and delete everything manually using the 
terminal.

After some time, (maybe a week or a month later, it doesn't really matter) the 
application wants to write again on that folder, but ops, the folder was 
removed. As application is very well coded :-), it checks for that folder and 
note that it doesn't exist anymore and needs to be recreated.

But, when the application try to do so, nothing happens, because the cache is 
not updated. ;/

Maybe distutils package was not designed for the purpose I am using it (I am 
not using it to install python modules or anything), but this behavior is not 
well documented anyway.

If you really think the cache is important, two things need to be done:
1) Implement a way to update/clear the cache
2) Include details about the cache and its implications on distutils 
documentation

--

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



[issue10948] Trouble with dir_util created dir cache

2011-01-19 Thread Diego Queiroz

Diego Queiroz  added the comment:

You were right, "os.makedirs" fits my needs. :-)

Anyway, I still think the change in the documentation is needed.
This is not an implementation detail, it is part of the way the function works.

The user should be aware of the behavior when he call this function twice. In 
my opinion, the documentation should be clear about everything. We could call 
this an implementation detail iff it does not affect anything externally, but 
this is not the case (it affects subsequent calls).

This function does exactly the same of "os.makedirs" but the why is discribed 
only in a comment inside the code. We know this is a poor programming style. 
This information need to be available in the documentation too.

--

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



[issue10948] Trouble with dir_util created dir cache

2011-01-20 Thread Diego Queiroz

Diego Queiroz  added the comment:

"I would agree if mkpath were a public function."
So It is better to define what a "public function" is. Any function in any 
module of any project, if it is indented to be used by other modules, it is 
public by definition.

If new people get involved in distutils development they will need to read all 
the code, line by line and every comment, because the old developers decided 
not to document the inner workings of its functions.

"Considering that dir_util is gone in distutils2, I see no benefit in editing 
the doc."
Well, I know nothing about this. However, if you tell me that distutils2 will 
replace distutils, I may agree with you and distutils just needs to be 
deprecated. Otherwise, I keep my opinion.

--

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



[issue8087] Unupdated source file in traceback

2010-03-07 Thread Diego Mascialino

New submission from Diego Mascialino :

Example:

 mod.py 
def f():
a,b,c = 1,2
print b


If i do:

>>> import mod
>>> mod.f()

I get:

Traceback (most recent call last):
  File "", line 1, in 
  File "mod.py", line 2, in f
a,b,c = 1,2
ValueError: need more than 2 values to unpack


If i fix the source:

 mod.py 
def f():
a,b,c = 1,2,3
print b


And do:

>>> mod.f()

I get:

Traceback (most recent call last):
  File "", line 1, in 
  File "mod.py", line 2, in f
a,b,c = 1,2,3
ValueError: need more than 2 values to unpack

The problem is that the source shown is updated, but the executed code is old, 
because it wasn't reloaded.

Feature request:

If the source code shown was modified after import time and it wasn't reloaded, 
a warning message should be shown.

Example:

Traceback (most recent call last):
  File "", line 1, in 
  File "mod.py", line 2, in f  WARNING: Modified after import!
a,b,c = 1,2,3
ValueError: need more than 2 values to unpack

or something like that. Maybe "use reload()" might appear.

--
components: Interpreter Core
messages: 100600
nosy: dmascialino, jjconti
severity: normal
status: open
title: Unupdated source file in traceback
type: feature request
versions: Python 2.7

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



[issue8087] Unupdated source file in traceback

2010-03-07 Thread Diego Mascialino

Diego Mascialino  added the comment:

Martin, I am not talking about a loop checking source file changes.

I think the check could be done only when the traceback is printed.

The function PyErr_Display() calls PyTracBack_Print() and so on until 
_Py_DisplaySourceLine() is called. The latter reads the source file and prints 
the line. I don't know which is the best way to know if the source file was 
updated. But i think that it's possible to check it there.

I think this could apply only when using the interactive console.

--

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



[issue37904] Suggested edit to Python Tutorial - Section 4

2019-09-15 Thread Diego Barriga


Change by Diego Barriga :


--
nosy: +umoqnier

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



[issue37904] Suggested edit to Python Tutorial - Section 4

2019-09-15 Thread Diego Barriga


Diego Barriga  added the comment:

I'm interest on this for my first contribution :D

--

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



[issue38179] Test subprocess fails on Fedora 30: test_group and test_extra_groups

2019-09-15 Thread Diego Barriga


New submission from Diego Barriga :

==
ERROR: test_extra_groups (test.test_subprocess.POSIXProcessTestCase)
--
Traceback (most recent call last):
  File "/home/umoqnier/develop/python-dev/cpython/Lib/test/test_subprocess.py", 
line 1840, in test_extra_groups
output = subprocess.check_output(
  File "/home/umoqnier/develop/python-dev/cpython/Lib/subprocess.py", line 419, 
in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/home/umoqnier/develop/python-dev/cpython/Lib/subprocess.py", line 497, 
in run
with Popen(*popenargs, **kwargs) as process:
  File "/home/umoqnier/develop/python-dev/cpython/Lib/subprocess.py", line 889, 
in __init__
gids.append(grp.getgrnam(extra_group).gr_gid)
KeyError: "getgrnam(): name not found: 'nogroup'"

==
ERROR: test_group (test.test_subprocess.POSIXProcessTestCase) (group='nogroup')
--
Traceback (most recent call last):
  File "/home/umoqnier/develop/python-dev/cpython/Lib/test/test_subprocess.py", 
line 1800, in test_group
output = subprocess.check_output(
  File "/home/umoqnier/develop/python-dev/cpython/Lib/subprocess.py", line 419, 
in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/home/umoqnier/develop/python-dev/cpython/Lib/subprocess.py", line 497, 
in run
with Popen(*popenargs, **kwargs) as process:
  File "/home/umoqnier/develop/python-dev/cpython/Lib/subprocess.py", line 862, 
in __init__
gid = grp.getgrnam(group).gr_gid
KeyError: "getgrnam(): name not found: 'nogroup'"

--

Ran 306 tests in 26.423s

FAILED (errors=2, skipped=31)
test test_subprocess failed

== Tests result: FAILURE ==

1 test failed:
test_subprocess

Total duration: 26 sec 676 ms
Tests result: FAILURE

--
components: Tests
messages: 352495
nosy: umoqnier
priority: normal
severity: normal
status: open
title: Test subprocess fails on Fedora 30: test_group and test_extra_groups
type: behavior
versions: Python 3.9

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



[issue38179] Test subprocess fails on Fedora 30: test_group and test_extra_groups

2019-09-15 Thread Diego Barriga


Diego Barriga  added the comment:

$  cat /etc/os-release 
NAME=Fedora
VERSION="30 (Workstation Edition)"
ID=fedora
VERSION_ID=30
VERSION_CODENAME=""
PLATFORM_ID="platform:f30"
PRETTY_NAME="Fedora 30 (Workstation Edition)"
ANSI_COLOR="0;34"
LOGO=fedora-logo-icon
CPE_NAME="cpe:/o:fedoraproject:fedora:30"
HOME_URL="https://fedoraproject.org/";
DOCUMENTATION_URL="https://docs.fedoraproject.org/en-US/fedora/f30/system-administrators-guide/";
SUPPORT_URL="https://fedoraproject.org/wiki/Communicating_and_getting_help";
BUG_REPORT_URL="https://bugzilla.redhat.com/";
REDHAT_BUGZILLA_PRODUCT="Fedora"
REDHAT_BUGZILLA_PRODUCT_VERSION=30
REDHAT_SUPPORT_PRODUCT="Fedora"
REDHAT_SUPPORT_PRODUCT_VERSION=30
PRIVACY_POLICY_URL="https://fedoraproject.org/wiki/Legal:PrivacyPolicy";
VARIANT="Workstation Edition"
VARIANT_ID=workstation

--

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



[issue38180] Test pyexpat fails on Fedora 30

2019-09-15 Thread Diego Barriga


New submission from Diego Barriga :

$ ./python -m test -j8 test_pyexpat
Run tests in parallel using 8 child processes
0:00:00 load avg: 0.66 [1/1/1] test_pyexpat failed
test test_pyexpat failed -- Traceback (most recent call last):
  File "/home/umoqnier/develop/python-dev/cpython/Lib/test/test_pyexpat.py", 
line 454, in test_exception
parser.Parse(b"", True)
RuntimeError: a

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/umoqnier/develop/python-dev/cpython/Lib/test/test_pyexpat.py", 
line 470, in test_exception
self.assertIn('call_with_frame("StartElement"', entries[1][3])
AssertionError: 'call_with_frame("StartElement"' not found in ''

== Tests result: FAILURE ==

1 test failed:
test_pyexpat

Total duration: 211 ms
Tests result: FAILURE

--
components: Tests
messages: 352497
nosy: umoqnier
priority: normal
severity: normal
status: open
title: Test pyexpat fails on Fedora 30
versions: Python 3.9

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



[issue38180] Test pyexpat fails on Fedora 30

2019-09-15 Thread Diego Barriga


Change by Diego Barriga :


--
type:  -> behavior

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



[issue38180] Test pyexpat fails on Fedora 30

2019-09-15 Thread Diego Barriga


Diego Barriga  added the comment:

$  cat /etc/os-release  
NAME=Fedora
VERSION="30 (Workstation Edition)"
ID=fedora
VERSION_ID=30
VERSION_CODENAME=""
PLATFORM_ID="platform:f30"
PRETTY_NAME="Fedora 30 (Workstation Edition)"
ANSI_COLOR="0;34"
LOGO=fedora-logo-icon
CPE_NAME="cpe:/o:fedoraproject:fedora:30"
HOME_URL="https://fedoraproject.org/";
DOCUMENTATION_URL="https://docs.fedoraproject.org/en-US/fedora/f30/system-administrators-guide/";
SUPPORT_URL="https://fedoraproject.org/wiki/Communicating_and_getting_help";
BUG_REPORT_URL="https://bugzilla.redhat.com/";
REDHAT_BUGZILLA_PRODUCT="Fedora"
REDHAT_BUGZILLA_PRODUCT_VERSION=30
REDHAT_SUPPORT_PRODUCT="Fedora"
REDHAT_SUPPORT_PRODUCT_VERSION=30
PRIVACY_POLICY_URL="https://fedoraproject.org/wiki/Legal:PrivacyPolicy";
VARIANT="Workstation Edition"
VARIANT_ID=workstation

--

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



[issue37904] Suggested edit to Python Tutorial - Section 4

2019-09-15 Thread Diego Barriga


Change by Diego Barriga :


--
keywords: +patch
pull_requests: +15779
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/16169

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



[issue38180] Test pyexpat fails on Fedora 30

2019-09-17 Thread Diego Barriga


Diego Barriga  added the comment:

$ rpm -qa expat
expat-2.2.7-1.fc30.x86_64
expat-2.2.7-1.fc30.i686

--

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



[issue38179] Test subprocess fails on Fedora 30: test_group and test_extra_groups

2019-09-17 Thread Diego Barriga


Diego Barriga  added the comment:

That's right. The test result was success on latest master. Should i close this 
issue?

--

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



[issue44892] Percentage character (%) inside a comment is badly recognized when using configparser

2021-08-11 Thread Diego Ramirez


New submission from Diego Ramirez :

On the Pip GitHub issue tracker (https://github.com/pypa/pip/issues/10348), a 
user reported a strange behaviour when using a config file (setup.cfg) on its 
project.

The config file had a percentage character ("%") inside a commentary. But the 
module "configparser" failed with traceback:

configparser.InterpolationSyntaxError: '%' must be followed by '%' or '(', 
found: "%' in string formatting

We consider that the character was badly recognized as a part of the file, when 
it was just a part of an inline comment.

Is there any way to fix this bug?

--
components: Library (Lib)
messages: 399415
nosy: DiddiLeija
priority: normal
severity: normal
status: open
title: Percentage character (%) inside a comment is badly recognized when using 
configparser
type: crash
versions: Python 3.9

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



[issue44892] configparser fails when the file contains a "%" inside a commentary

2021-08-11 Thread Diego Ramirez


Change by Diego Ramirez :


--
title: Percentage character (%) inside a comment is badly recognized when using 
configparser -> configparser fails when the file contains a "%" inside a 
commentary

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



[issue44892] configparser fails when the file contains a "%" inside a commentary

2021-08-13 Thread Diego Ramirez


Diego Ramirez  added the comment:

Lukasz Langa, I would like to know your opinion, as you are recognized as the 
"configparser" developer.

--
nosy: +lukasz.langa

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



[issue44892] [configparser] Module configparser fails when the file contains a "%" inside a commentary

2021-08-13 Thread Diego Ramirez


Diego Ramirez  added the comment:

I would like to give a better explanation of the issue (maybe the previous 
explanation was unclear). A user reported to Pip that, when he used a 
"setup.cfg" file, the configparser module crashed (as I said above).

The file contained a percentage character (%) inside a commentary (which is 
expected to be ignored):

[flake8]
ignore =
WPS323  #  percentage sign '%'

And, because pip uses configparser on those cases, any operation with pip fails.

So, I would like to know if we can do something to fix this bug (I noticed the 
place where it fails at 
https://github.com/python/cpython/blob/main/Lib/configparser.py#L442). If I can 
fill a PR to help, just tell me, OK?

--
title: configparser fails when the file contains a "%" inside a commentary -> 
[configparser] Module configparser fails when the file contains a "%" inside a 
commentary

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



[issue44603] REPL: exit when the user types exit instead of asking them to explicitly type exit()

2021-08-23 Thread Diego Ramirez


Change by Diego Ramirez :


--
nosy: +DiddiLeija

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



[issue44892] [configparser] Module configparser fails when the config file contains a "%" inside a commentary

2021-08-23 Thread Diego Ramirez


Change by Diego Ramirez :


--
nosy: +uranusjr
title: [configparser] Module configparser fails when the file contains a "%" 
inside a commentary -> [configparser] Module configparser fails when the config 
file contains a "%" inside a commentary

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



[issue45066] email parser fails to decode quoted-printable rfc822 message attachemnt

2021-08-31 Thread Diego Ramirez


Change by Diego Ramirez :


--
nosy: +DiddiLeija

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



[issue45059] Typo: using "==" instead of "="

2021-08-31 Thread Diego Ramirez


Change by Diego Ramirez :


--
nosy: +DiddiLeija

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



[issue45055] Fresh build on Windows fails the first time for zlib.c

2021-08-31 Thread Diego Ramirez


Change by Diego Ramirez :


--
nosy: +DiddiLeija

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



[issue44892] [configparser] Module configparser fails when the config file contains a "%" inside a commentary

2021-09-05 Thread Diego Ramirez


Diego Ramirez  added the comment:

Any commentaries about this issue?

--

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



[issue45100] Teach help about typing.overload()

2021-09-05 Thread Diego Ramirez


Change by Diego Ramirez :


--
nosy: +DiddiLeija

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



[issue44892] [configparser] Module configparser fails when the config file contains a "%" inside a commentary

2021-09-05 Thread Diego Ramirez


Change by Diego Ramirez :


--
type: crash -> behavior

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



[issue45035] sysconfig's posix_home scheme has different platlib value to distutils's unix_home

2021-09-07 Thread Diego Ramirez


Change by Diego Ramirez :


--
nosy: +DiddiLeija

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



[issue45127] Code objects can contain unmarshallable objects

2021-09-07 Thread Diego Ramirez


Change by Diego Ramirez :


--
nosy: +DiddiLeija

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



[issue42064] Convert sqlite3 to multi-phase initialisation (PEP 489)

2021-09-08 Thread Diego Ramirez


Change by Diego Ramirez :


--
nosy: +DiddiLeija

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



[issue45083] Need to use the exception class qualname when rendering exception (in C code)

2021-09-15 Thread Diego Ramirez


Change by Diego Ramirez :


--
nosy: +DiddiLeija

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



[issue44892] Configparser fails when the .cfg file contains comments

2021-09-25 Thread Diego Ramirez


Diego Ramirez  added the comment:

Hi Terry, I didn't see your response. I think this won't be possible, taking in 
count the comment that Serhiy posted:

> By default configparser does not support inline comments. "#  percentage sign 
> '%'" is a part of value. If you want to support inline comments you should 
> pass the inline_comment_prefixes argument.

Maybe this is a reasonable behavior. What do you think about it?

--

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



[issue44892] Configparser fails when the .cfg file contains inline 'comments'

2021-09-25 Thread Diego Ramirez


Diego Ramirez  added the comment:

Sure, thanks!

--

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



[issue45404] Undefined I_* macros when building 3.10 on Ubuntu?

2021-10-07 Thread Diego Alonso

New submission from Diego Alonso :

Trying to build Python 3.10 on Ubuntu 20.04. It builds everything but the fcntl 
module; ie. at the end it says:

Failed to build these modules:
fcntl.

Here are the compilation errors. It's trying to use certain macros that are 
undefined: I_PUSH, I_POP, I_LOOK, I_FLUSH, I_FLUSHBAND, I_SETSIG, I_GETSIG, 
I_FIND, I_PEEK, I_SRDOPT, I_GRDOPT, I_NREAD, I_FDINSERT, I_STR, I_SWROPT, 
I_SENDFD, I_RECVFD, I_LIST, I_ATMARK, I_CKBAND, I_GETBAND, I_CANPUT, 
I_SETCLTIME, I_LINK, I_UNLINK, I_PLINK, I_PUNLINK


Modules/_xxsubinterpretersmodule.o
In file included from ./Include/Python.h:140,
 from /home/da/git/Python-3.10.0/Modules/fcntlmodule.c:6:
/home/da/git/Python-3.10.0/Modules/fcntlmodule.c: In function ‘all_ins’:
/home/da/git/Python-3.10.0/Modules/fcntlmodule.c:614:33: error: ‘I_PUSH’ 
undeclared (first use in this function)
  614 | if (PyModule_AddIntMacro(m, I_PUSH)) return -1;
  | ^~
./Include/modsupport.h:154:67: note: in definition of macro 
‘PyModule_AddIntMacro’
  154 | #define PyModule_AddIntMacro(m, c) PyModule_AddIntConstant(m, #c, c)
  |   ^
/home/da/git/Python-3.10.0/Modules/fcntlmodule.c:614:33: note: each undeclared 
identifier is reported only once for each function it appears in
  614 | if (PyModule_AddIntMacro(m, I_PUSH)) return -1;
  | ^~
./Include/modsupport.h:154:67: note: in definition of macro 
‘PyModule_AddIntMacro’
  154 | #define PyModule_AddIntMacro(m, c) PyModule_AddIntConstant(m, #c, c)
  |   ^
/home/da/git/Python-3.10.0/Modules/fcntlmodule.c:615:33: error: ‘I_POP’ 
undeclared (first use in this function)
  615 | if (PyModule_AddIntMacro(m, I_POP)) return -1;
  | ^
./Include/modsupport.h:154:67: note: in definition of macro 
‘PyModule_AddIntMacro’
  154 | #define PyModule_AddIntMacro(m, c) PyModule_AddIntConstant(m, #c, c)
  |   ^
/home/da/git/Python-3.10.0/Modules/fcntlmodule.c:616:33: error: ‘I_LOOK’ 
undeclared (first use in this function); did you mean ‘F_LOCK’?
  616 | if (PyModule_AddIntMacro(m, I_LOOK)) return -1;
  | ^~
./Include/modsupport.h:154:67: note: in definition of macro 
‘PyModule_AddIntMacro’
  154 | #define PyModule_AddIntMacro(m, c) PyModule_AddIntConstant(m, #c, c)
  |   ^
/home/da/git/Python-3.10.0/Modules/fcntlmodule.c:617:33: error: ‘I_FLUSH’ 
undeclared (first use in this function); did you mean ‘CFLUSH’?
  617 | if (PyModule_AddIntMacro(m, I_FLUSH)) return -1;
  | ^~~
./Include/modsupport.h:154:67: note: in definition of macro 
‘PyModule_AddIntMacro’
  154 | #define PyModule_AddIntMacro(m, c) PyModule_AddIntConstant(m, #c, c)
  |   ^
/home/da/git/Python-3.10.0/Modules/fcntlmodule.c:618:33: error: ‘I_FLUSHBAND’ 
undeclared (first use in this function)
  618 | if (PyModule_AddIntMacro(m, I_FLUSHBAND)) return -1;
  | ^~~
./Include/modsupport.h:154:67: note: in definition of macro 
‘PyModule_AddIntMacro’
  154 | #define PyModule_AddIntMacro(m, c) PyModule_AddIntConstant(m, #c, c)
  |   ^
/home/da/git/Python-3.10.0/Modules/fcntlmodule.c:619:33: error: ‘I_SETSIG’ 
undeclared (first use in this function); did you mean ‘F_SETSIG’?
  619 | if (PyModule_AddIntMacro(m, I_SETSIG)) return -1;
  | ^~~~
./Include/modsupport.h:154:67: note: in definition of macro 
‘PyModule_AddIntMacro’
  154 | #define PyModule_AddIntMacro(m, c) PyModule_AddIntConstant(m, #c, c)
  |   ^
/home/da/git/Python-3.10.0/Modules/fcntlmodule.c:620:33: error: ‘I_GETSIG’ 
undeclared (first use in this function); did you mean ‘F_GETSIG’?
  620 | if (PyModule_AddIntMacro(m, I_GETSIG)) return -1;
  | ^~~~
./Include/modsupport.h:154:67: note: in definition of macro 
‘PyModule_AddIntMacro’
  154 | #define PyModule_AddIntMacro(m, c) PyModule_AddIntConstant(m, #c, c)
  |   ^
/home/da/git/Python-3.10.0/Modules/fcntlmodule.c:621:33: error: ‘I_FIND’ 
undeclared (first use in this function)
  621 | if (PyModule_AddIntMacro(m, I_FIND)) return -1;
  | ^~
./Include/modsupport.h:154:67: note: in definition of macro 
‘PyModule_AddIntMacro’
  154 | #define PyModule_AddIntMa

[issue41105] Add some extra content check in configure process for some empty header file who has been deprecated by glibc

2021-10-07 Thread Diego Alonso


Diego Alonso  added the comment:

Yes, I have the same problem. The empty file is needed to avoid compilation 
errors in certain builds, but in this case it creates an error...

--
nosy: +etale-cohomology

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



[issue45126] [sqlite3] cleanup and harden Connection and Cursor __init__

2021-10-13 Thread Diego Ramirez


Change by Diego Ramirez :


--
nosy: +DiddiLeija

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



[issue45404] Undefined I_* macros of stropts.h when building Python 3.10 on Ubuntu: fail to build the fcntl module

2021-10-14 Thread Diego Alonso


Diego Alonso  added the comment:

I had an empty stropts.h lying around somewhere in /usr/* (can't remember 
where) because some programs don't compile if they don't see that file (even an 
empty one suffices). But Python doesn't compile if it sees it... So I deleted 
stropts.h and then ran ./configure again, compiled, and it worked.

The Python build code should be modified to set HAVE_STROPTS_H to 0 on 
platforms (like Linux) that don't support stropts.h

--

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



[issue40074] pickle module dump and load: add support for string file names

2020-03-26 Thread Diego Palacios


New submission from Diego Palacios :

The pickle functions dump and load are often used in the following lines:

```python
import pickle

fname = '/path/to/file.pickle'

with open(fname, 'rb') as f:
object = pickle.load(f)
```

The load function should also accept a file name (string) as input and 
automatically open and load the object. The same should happen for the dump 
function. This would allow a simple use of the functions:

```python
object = pickle.load(fname)
```

This is what many users need when reading and storing and object from/to a file.

--
components: Library (Lib)
messages: 365061
nosy: Diego Palacios
priority: normal
severity: normal
status: open
title: pickle module dump and load: add support for string file names
type: enhancement
versions: Python 3.9

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



[issue40074] pickle module dump and load: add support for string file names

2020-03-26 Thread Diego Palacios


Diego Palacios  added the comment:

In this case two new functions should be added to the pickle function. I think 
they would be very useful and many users would make use of them.

--

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



[issue33361] readline() + seek() on codecs.EncodedFile breaks next readline()

2019-05-26 Thread Diego Argueta


Diego Argueta  added the comment:

> though #32110 ("Make codecs.StreamReader.read() more compatible with read() 
> of other files") may have fixed more (all?) of it.

Still seeing this in 3.7.3 so I don't think so?

--

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



[issue34160] ElementTree not preserving attribute order

2019-07-15 Thread Diego Rojas


Diego Rojas  added the comment:

Victor, you mean place again this code? 
https://github.com/python/cpython/pull/10163/files#diff-d5a064acb6ae44dcb7e01fee148c733dR926

And the recipe proposed in https://bugs.python.org/issue34160#msg338102 place 
it as a method of ElementTree or just as a helper function?

--

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



[issue31433] Impossible download python 3.6.2 and 2.7 documentation (html)

2017-09-12 Thread Diego Satoba

New submission from Diego Satoba:

Hi, 

Links to python 3.6.2 and 2.7 documentation in HTML are broken, web server 
returns 404 Not Found.

The links are:
https://docs.python.org/2/archives/python-2.7.14rc1-docs-html.zip
https://docs.python.org/3/archives/python-3.6.2-docs-html.zip

--
messages: 301979
nosy: Diego Satoba
priority: normal
severity: normal
status: open
title: Impossible download python 3.6.2 and 2.7 documentation (html)
type: resource usage
versions: Python 2.7, Python 3.7

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



[issue3991] urllib.request.urlopen does not handle non-ASCII characters

2019-02-20 Thread Diego Rojas


Change by Diego Rojas :


--
components: +Extension Modules -Library (Lib), Unicode
type: enhancement -> behavior
versions: +Python 3.4, Python 3.5, Python 3.6, Python 3.8

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



[issue30127] argparse action not correctly describing the right behavior

2017-04-21 Thread Diego Costantini

New submission from Diego Costantini:

Here https://docs.python.org/2/library/argparse.html#action we have the 
following:

>>> parser = argparse.ArgumentParser()
>>> parser.add_argument('--foo', action='store_true')
>>> parser.add_argument('--bar', action='store_false')
>>> parser.add_argument('--baz', action='store_false')
>>> parser.parse_args('--foo --bar'.split())
Namespace(bar=False, baz=True, foo=True)

baz should be False because omitted.
I also tested it.

--
assignee: docs@python
components: Documentation
messages: 292044
nosy: Diego Costantini, docs@python
priority: normal
severity: normal
status: open
title: argparse action not correctly describing the right behavior
type: behavior
versions: Python 2.7

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



[issue30127] argparse action not correctly describing the right behavior

2017-04-21 Thread Diego Costantini

Diego Costantini added the comment:

You are right, I misunderstood the part where it sets defaults opposite to the 
stored value, although apparently over one year ago I did understand it 
correctly when I first went through that documentation.

Today my second pair of eyes had my same understanding of it though :)

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

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



[issue34160] ElementTree not preserving attribute order

2019-03-14 Thread Diego Rojas


Diego Rojas  added the comment:

Victor, I thought that the news changes were only for major changes. 

In another hand, I could retake this bug in a few days with the issues that you 
mentioned.

--

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



[issue34160] ElementTree not preserving attribute order

2019-03-14 Thread Diego Rojas


Change by Diego Rojas :


--
pull_requests: +12306

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



[issue34160] ElementTree not preserving attribute order

2019-03-15 Thread Diego Rojas

Diego Rojas  added the comment:

Stéphane, According to you PR, I agree that is a good approach give the option 
to the user if wants sorted or not the attributes. But in this thread, is 
discussed that there is not necessary and leaves as default that the attributes 
preserve the order.

--

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



[issue33038] GzipFile doesn't always ignore None as filename

2018-03-09 Thread Diego Argueta

New submission from Diego Argueta :

The Python documentation states that if the GzipFile can't determine a filename 
from `fileobj` it'll use an empty string and won't be included in the header. 
Unfortunately, this doesn't work for SpooledTemporaryFile which has a `name` 
attribute but doesn't set it initially. The result is a crash.

To reproduce

```
import gzip
import tempfile

with tempfile.SpooledTemporaryFile() as fd:
with gzip.GzipFile(mode='wb', fileobj=fd) as gz:
gz.write(b'asdf')
```

Result:
```
Traceback (most recent call last):
  File "", line 2, in 
  File "/Users/diegoargueta/.pyenv/versions/2.7.14/lib/python2.7/gzip.py", line 
136, in __init__
self._write_gzip_header()
  File "/Users/diegoargueta/.pyenv/versions/2.7.14/lib/python2.7/gzip.py", line 
170, in _write_gzip_header
fname = os.path.basename(self.name)
  File "/Users/diegoargueta/.pyenv/versions/gds27/lib/python2.7/posixpath.py", 
line 114, in basename
i = p.rfind('/') + 1
AttributeError: 'NoneType' object has no attribute 'rfind'
```

This doesn't happen on Python 3.6, where the null filename is handled properly. 
I've attached a patch file that fixed the issue for me.

--
components: Library (Lib)
files: gzip_filename_fix.patch
keywords: patch
messages: 313512
nosy: da
priority: normal
severity: normal
status: open
title: GzipFile doesn't always ignore None as filename
type: crash
versions: Python 2.7
Added file: https://bugs.python.org/file47473/gzip_filename_fix.patch

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



[issue33038] GzipFile doesn't always ignore None as filename

2018-03-11 Thread Diego Argueta

Diego Argueta  added the comment:

Yeah that's fine. Thanks!

--

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



[issue33361] readline() + seek() on io.EncodedFile breaks next readline()

2018-04-25 Thread Diego Argueta

New submission from Diego Argueta :

It appears that calling readline() on a codecs.EncodedFile stream breaks 
seeking and causes subsequent attempts to iterate over the lines or call 
readline() to backtrack and return already consumed lines.

A minimal example:

```
from __future__ import print_function

import codecs
import io


def run(stream):
offset = stream.tell()
try:
stream.seek(0)
header_row = stream.readline()
finally:
stream.seek(offset)

print('Got header: %r' % header_row)

if stream.tell() == 0:
print('Skipping the header: %r' % stream.readline())

for index, line in enumerate(stream, start=2):
print('Line %d: %r' % (index, line))


b = io.BytesIO(u'a,b\r\n"asdf","jkl;"\r\n'.encode('utf-16-le'))
s = codecs.EncodedFile(b, 'utf-8', 'utf-16-le')

run(s)
```

Output:

```
Got header: 'a,b\r\n'
Skipping the header: '"asdf","jkl;"\r\n'<-- this is line 2
Line 2: 'a,b\r\n'   <-- this is line 1
Line 3: '"asdf","jkl;"\r\n' <-- now we're back to line 2
```

As you can see, the line being skipped is actually the second line, and when we 
try reading from the stream again, the iterator starts from the beginning of 
the file.

Even weirder, adding a second call to readline() to skip the second line shows 
it's going **backwards**:

```
Got header: 'a,b\r\n'
Skipping the header: '"asdf","jkl;"\r\n'<-- this is actually line 2
Skipping the second line: 'a,b\r\n' <-- this is line 1
Line 2: '"asdf","jkl;"\r\n' <-- this is now correct
```

The expected output shows that we got a header, skipped it, and then read one 
data line.

```
Got header: 'a,b'
Skipping the header: 'a,b\r\n'
Line 2: '"asdf","jkl;"\r\n'
```

I'm sure this is related to the implementation of readline() because if we 
change this:

```
header_row = stream.readline()
```

to this:

```
header_row = stream.read().splitlines()[0]
```

then we get the expected output. If on the other hand we comment out the seek() 
in the finally clause, we also get the expected output (minus the "skipping the 
header") code.

--
components: IO, Library (Lib)
messages: 315768
nosy: da
priority: normal
severity: normal
status: open
title: readline() + seek() on io.EncodedFile breaks next readline()
type: behavior
versions: Python 2.7, Python 3.6

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



[issue33361] readline() + seek() on io.EncodedFile breaks next readline()

2018-04-26 Thread Diego Argueta

Diego Argueta  added the comment:

That's because the stream isn't transcoding, since UTF-8 is ASCII-compatible. 
Try using something not ASCII-compatible as the codec e.g. 'ibm500' and it'll 
give incorrect results.

```
b = io.BytesIO(u'a,b\r\n"asdf","jkl;"\r\n'.encode('ibm500'))
s = codecs.EncodedFile(b, 'ibm500')
```

```
Got header: '\x81k\x82\r%'
Skipping the header. '\x7f\x81\xa2\x84\x86\x7fk\x7f\x91\x92\x93^\x7f\r%'
Line 2: '\x81k\x82\r%'
Line 3: '\x7f\x81\xa2\x84\x86\x7fk\x7f\x91\x92\x93^\x7f\r%'
```

--

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



[issue33361] readline() + seek() on io.EncodedFile breaks next readline()

2018-04-26 Thread Diego Argueta

Diego Argueta  added the comment:

Update: If I run your exact code it still breaks for me:

```
Got header: 'abc\n'
Skipping the header. 'def\n'
Line 2: 'ghi\n'
Line 3: 'abc\n'
Line 4: 'def\n'
Line 5: 'ghi\n'
```

I'm running Python 2.7.14 and 3.6.5 on OSX 10.13.4. Startup banners:

Python 2.7.14 (default, Feb  7 2018, 14:15:12) 
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.39.2)] on darwin

Python 3.6.5 (default, Apr  2 2018, 14:03:12) 
[GCC 4.2.1 Compatible Apple LLVM 9.1.0 (clang-902.0.39.1)] on darwin

--

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



[issue33038] GzipFile doesn't always ignore None as filename

2018-05-01 Thread Diego Argueta

Diego Argueta  added the comment:

Did this make it into 2.7.15? There aren't any release notes for it on the 
download page like usual.

--

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



[issue33361] readline() + seek() on io.EncodedFile breaks next readline()

2018-05-21 Thread Diego Argueta

Diego Argueta  added the comment:

Update: Tested this on Python 3.5.4, 3.4.8, and 3.7.0b3 on OSX 10.13.4. They 
also exhibit the bug. Updating the ticket accordingly.

--
versions: +Python 3.4, Python 3.5, Python 3.7

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



[issue33593] Support heapq on typed arrays?

2018-05-21 Thread Diego Argueta

New submission from Diego Argueta :

It'd be really great if we could have support for using the `heapq` module on 
typed arrays from `array`. For example:


```
import array
import heapq
import random

a = array.array('I', (random.randrange(10) for _ in range(10)))
heapq.heapify(a)
```

Right now this code throws a TypeError:

TypeError: heap argument must be a list


I suppose I could use `bisect` to insert items one by one but I imagine a 
single call to heapify() would be more efficient, especially if I'm loading the 
array from a byte string.

>From what I can tell the problem lies in the C implementation, since removing 
>the _heapq imports at the end of the heapq module (in 3.6) makes it work.

--
components: Library (Lib)
messages: 317250
nosy: da
priority: normal
severity: normal
status: open
title: Support heapq on typed arrays?
type: enhancement
versions: Python 2.7, Python 3.6

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



[issue33593] Support heapq on typed arrays?

2018-05-22 Thread Diego Argueta

Diego Argueta  added the comment:

I was referring to the C arrays in the Python standard library: 
https://docs.python.org/3/library/array.html

--

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



[issue33593] Support heapq on typed arrays?

2018-05-22 Thread Diego Argueta

Diego Argueta  added the comment:

However I do see your point about the speed.

--

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



[issue33361] readline() + seek() on codecs.EncodedFile breaks next readline()

2018-07-13 Thread Diego Argueta


Diego Argueta  added the comment:

Bug still present in 3.7.0, now seeing it in 3.8.0a0 as well.

--
versions: +Python 3.8

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



[issue34160] ElementTree not preserving attribute order

2018-10-26 Thread Diego Rojas


Diego Rojas  added the comment:

I'm working on this issue, but I have some questions:

1. If dump() function is only for debugging purpose, and since from dump() is 
where we will pass the sort_attrs keyword in False in order to conserve the 
order, I don't see how from dump() we can handle the order of the keyword 
arguments. The sorted occurs in line 926 
(https://github.com/python/cpython/blob/master/Lib/xml/etree/ElementTree.py#L926)
 and 
982(https://github.com/python/cpython/blob/master/Lib/xml/etree/ElementTree.py#L982)
 when xml or html are serialized. Or could we pass the sort_attrs to the 
functions _serialize_html/_serialize_xml and there handle this?

2. Just a comment, maybe sort_attrs is not ambiguous? For a user would be clear 
that sort_attrs will order the arguments in lexical order or maybe he/she could 
be confused and take it as that will respect the order of the keywords passed?

--
nosy: +dfrojas

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



[issue34160] ElementTree not preserving attribute order

2018-10-28 Thread Diego Rojas


Diego Rojas  added the comment:

Raymond, sure. I could do the rest, I'll start tomorrow Monday.

--

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



[issue34160] ElementTree not preserving attribute order

2018-10-29 Thread Diego Rojas


Change by Diego Rojas :


--
pull_requests: +9535

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



[issue34160] ElementTree not preserving attribute order

2018-10-29 Thread Diego Rojas


Diego Rojas  added the comment:

Serhiy Storchaka, Raymond. I already made the 10219 PR. Preserves order in html 
Element attributes and minidom.

--

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



[issue34160] ElementTree not preserving attribute order

2018-11-10 Thread Diego Rojas


Diego Rojas  added the comment:

Ned, exactly what test fails? I ran all the test suite in local and all was ok, 
even all passed in the CI build.

--

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



[issue9218] pop multiple elements of a list at once

2010-07-10 Thread Diego Jacobi

New submission from Diego Jacobi :

I am currently working with buffer in an USB device and pyusb.
So when i read from a buffer endpoint i get an array.Array() list.
I handle this chunk of data with a thread to send a receive the information 
that i need. In this thread i load a list with all the information that is read 
from the USB device, and another layer with pop this information from the 
threads buffer.

The thing i found is that, to pop a variable chunk of data from this buffer 
without copying it and deleting the elements, i have to pop one element at the 
time.

def get_chunk(self, size):
for x in range(size):
yield self.recv_buffer.pop()

I guess that it would be improved if i can just pop a defined number of 
elements, like this:

pop self.recv_buffer[:size]
or
self.recv_buffer.pop(,-size)

That would be... "pop from the last element minus size to the last element"
in that way there is only one memory transaction.
The new list points to the old memory address and the recv_buffer is advanced 
to a new address. Data is not moved.

note that i like the idea of using "pop" as the "del" operator for lists

thanks.
Diego

--
messages: 109912
nosy: jacobidiego
priority: normal
severity: normal
status: open
title: pop multiple elements of a list at once
type: performance
versions: Python 2.6

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



[issue9240] different behaviour with for loop... interpreted vs scripted

2010-07-12 Thread Diego Jacobi

New submission from Diego Jacobi :

Hi.
I am not a python expert and i was trying to reduce this next code:

data = []
i = 0
for j in range(packetlen+1):
print i, self.channels_in[ channels[i] ]
data.append( self.channels_in[ channels[i] ].pop() )
i += 1
if i >= len(channels):
i=0

into something like this:

data = []
for j in range(packetlen+1), i in channels:
print j, i
data.append( self.channels_in[ i ].pop() )

which is much more readable and short.
But i didnt know if this sintax is really supported (also i didnt found 
examples on internet), so i just tried.

I runned the script and it didnt complains with errors, BUT i found that the 
behavior is not what i expected.

I expected j to take value of range() and i to take the values of channels 
until range() gets empty.

well, the actual behavior is that j takes the value of the complete range() as 
in
j = range(..)

and the for loop iterates as in 
for i in channels:


ALSO i tested this un the python command line and it produces different 
behaviours:

the same sintax writen as:

for j in range(1,5), i in range(120,500,12):
   print j, i

produces 

Traceback (most recent call last):
  File "", line 1, in 
NameError: name 'i' is not defined


Thats all. I guess that if it produces different results, then there is an 
error happening here.


If there is a pythonic way to do this:
for j in range(packetlen+1), i in channels:

please tell me.

Cheers.
Diego

--
messages: 110150
nosy: jacobidiego
priority: normal
severity: normal
status: open
title: different behaviour with for loop... interpreted vs scripted
type: behavior
versions: Python 2.6

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



[issue25200] bug on re.search using the char ,-:

2015-09-20 Thread Diego Palharini

New submission from Diego Palharini:

Using the packet re for regular expressions I found a strange behavior with the 
following command:


re.search("[,-:]","89")

it returns that one of those chars exists into the string "89" or whatever 
number you may use.

--
components: IDLE
messages: 251187
nosy: DPalharini
priority: normal
severity: normal
status: open
title: bug on re.search using the char ,-:
versions: Python 2.7

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



[issue2531] float compared to decimal is silently incorrect.

2008-04-01 Thread Diego Manenti Martins

Changes by Diego Manenti Martins <[EMAIL PROTECTED]>:


--
keywords: +patch
versions: +Python 2.6
Added file: http://bugs.python.org/file9922/decimal.patch

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



[issue40133] Provide additional matchers for unittest.mock

2020-04-01 Thread Diego Elio Pettenò

New submission from Diego Elio Pettenò :

The unittest.mock `assert_called_*with*` methods take either literals, or the 
single `ANY` special matcher 
(https://docs.python.org/3/library/unittest.mock.html#any) to match any 
argument.

Experience suggests me that it's useful to have more flexible matchers, such as 
INSTANCEOF or REGEXP.

Will provide a starting pull request for this today. (Be warned: it's the first 
time I try contributing to CPython.)

--
components: Tests
messages: 365457
nosy: Diego Elio Pettenò
priority: normal
severity: normal
status: open
title: Provide additional matchers for unittest.mock
type: enhancement
versions: Python 3.9

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



[issue40133] Provide additional matchers for unittest.mock

2020-04-02 Thread Diego Elio Pettenò

Change by Diego Elio Pettenò :


--
nosy: +gregory.p.smith

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



[issue14639] Different behavior for urllib2 in Python 2.7

2012-04-20 Thread Diego Manenti Martins

New submission from Diego Manenti Martins :

this code sends data in a different way if using python 2.6 or python 2.7

>>> import urllib2
>>> url = 'http://server.com/post_image?tid=zoV6LJ'
>>> f = open('test.jpg')
>>> data = f.read()
>>> res = urllib2.urlopen(url, data)

I checked it with wireshark and the data is sent in a different way when using 
python 2.7

The code works for python2.5 and python2.6

--
components: Library (Lib)
messages: 158897
nosy: Diego.Manenti.Martins
priority: normal
severity: normal
status: open
title: Different behavior for urllib2 in Python 2.7
type: behavior
versions: Python 2.7

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



[issue14639] Different behavior for urllib2 in Python 2.7

2012-04-20 Thread Diego Manenti Martins

Diego Manenti Martins  added the comment:

It stoped to work. It was working when using with python 2.6 and crashed on 
switching to python 2.7

I expect the same behavior of curl -X POST 
http://server.com/post_image?tid=zoV6LJ -T test.jpg

--

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