[issue29558] Provide run_until_complete inside loop

2017-02-15 Thread Javier Domingo

Javier Domingo added the comment:

Yes, indeed it is. Would it be possible to reconsider this functionality? It 
plays a key role when trying to rewrite full applications to async.

Rewriting the full stack of libraries at once is impossible, but the patching 
can easily be done in many cases.

--

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



[issue29558] Provide run_until_complete inside loop

2017-02-14 Thread Javier Domingo

New submission from Javier Domingo:

The current architecture of asyncio makes it really hard to combine both async 
and sync code.

When porting a Thread based application to asyncio, the first step is usually 
to start merging threads to the main loop, by using `run_coroutine_threadsafe`. 
This works well and allows to use a single ioloop from different threads.

There is another step, that usually involves the patching of libraries to work 
in an async way. One will typically patch the IO calls to be asyncio, and using 
`run_until_complete` proves useful in these situations.

However, at the moment it's not possible to `run_until_complete` from an 
ioloop. The possibility to be able to patch sync libraries to run in asyncio is 
something that would help a lot the migration.

This functionality would basically provide a way to continue running the ioloop 
until the future is resolved.

Sync code -> async code -> Sync code -> Async code

If you know how to have this without spawning an executor, that would be good 
too, in such case I would rather ask for documentation on how to do it =)

--
components: asyncio
messages: 287784
nosy: gvanrossum, txomon, yselivanov
priority: normal
severity: normal
status: open
title: Provide run_until_complete inside loop
type: enhancement
versions: Python 3.6, Python 3.7

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



[issue26467] Add async magic method support to unittest.mock.Mock

2016-12-19 Thread Javier Domingo

Javier Domingo added the comment:

I found this while trying to test an async context manager. This is a critical 
feature to enable migrations to async code, as the impossibility to test 
something properly is not acceptable in many environments.

Implementing it in a way that __call__ returns an object capable of being 
coroutine or normal function would avoid having to implement Async specific 
Mocks, wouldn't it? I am not too confident, but would it be doable to have an 
implementation that depends on whether _is_coroutine is accessed or not?

I don't like it, but I really don't like the fact that we need to patch 
different all the methods depending on whether they are coroutine or not.

Obviously, having the __acall__ method would really help solving this issue.

--
nosy: +txomon

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



[issue16890] minidom error

2013-01-08 Thread Javier Domingo

Javier Domingo added the comment:

Ok, sorry then.

Javier Domingo

2013/1/8 Ezio Melotti 

>
> Ezio Melotti added the comment:
>
> It happens with lists too:
> >>> l = list(range(10))
> >>> for x in l:
> ... l.remove(x)
> ...
> >>> l
> [1, 3, 5, 7, 9]
>
> --
>
> ___
> Python tracker 
> <http://bugs.python.org/issue16890>
> ___
>

--

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



[issue16890] minidom error

2013-01-08 Thread Javier Domingo

Javier Domingo added the comment:

I know that is the problem, but that shouldn't happen! if you remove a item
from a list, that doesn't happen. That is why I tagged the error as
minidom's
El 08/01/2013 04:24, "Ezio Melotti"  escribió:

>
> Ezio Melotti added the comment:
>
> The problem is that you are mutating parent.childNodes while you are
> iterating on it.  Iterating over a copy seems to solve the problem.
>
> --
> nosy: +ezio.melotti
> resolution:  -> invalid
> stage:  -> committed/rejected
> status: open -> closed
> type:  -> behavior
>
> ___
> Python tracker 
> <http://bugs.python.org/issue16890>
> ___
>

--

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



[issue16890] minidom error

2013-01-07 Thread Javier Domingo

New submission from Javier Domingo:

Hi I found something like a bug, I can't get this working:

import xml.dom.minidom as minidom
document="""




""" 
dom = minidom.parseString(document)

dom.childNodes
dom.childNodes[0].childNodes
dom.childNodes[0].childNodes[1].childNodes

def delete_recursive(parent):
for child in parent.childNodes:
if child.hasChildNodes():
delete_recursive(child)
else:
parent.removeChild(child)

delete_recursive(dom)

dom.childNodes
dom.childNodes[0].childNodes
dom.childNodes[0].childNodes[0].childNodes

Executes as:
>>> import xml.dom.minidom as minidom
>>> document="""
... 
... 
... 
... 
... """ 
>>> dom = minidom.parseString(document)
>>> 
>>> dom.childNodes
[]
>>> dom.childNodes[0].childNodes
[, , ]
>>> dom.childNodes[0].childNodes[1].childNodes
[, , , , ]
>>> 
>>> def delete_recursive(parent):
... for child in parent.childNodes:
... if child.hasChildNodes():
... delete_recursive(child)
... else:
... parent.removeChild(child)
... 
>>> delete_recursive(dom)
>>> 
>>> dom.childNodes
[]
>>> dom.childNodes[0].childNodes
[]
>>> dom.childNodes[0].childNodes[0].childNodes
[, , , , ]

The problem here is this last line, those text nodes shouldn't be here! I have 
traced the problem, and seem that the for loop is not correctly executed

--
components: XML
messages: 179309
nosy: txomon
priority: normal
severity: normal
status: open
title: minidom error
versions: Python 3.2

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



[issue16798] DTD not checked

2012-12-28 Thread Javier Domingo

Javier Domingo added the comment:

I am currently using a subprocess with a call to xmllint to make it create a 
temporal file that gets created on execution for xmllint use.

I have seen about lxml, but I wondered if there is any place in the standard 
python to put xml validation

--

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



[issue16798] DTD not checked

2012-12-27 Thread Javier Domingo

New submission from Javier Domingo:

Hi,

I am trying to find any tip on how to use minidom or etree xml implementations 
to check the xml syntax.

I just found that the only way to check xml syntax throught dtds is using lxml.

Would it be possible to implement this in the minidom or ElementTree default 
lib?

I have seen bug http://bugs.python.org/issue2124 that speaks about the dtds 
fetch, but didn't see any place where it speaks about them being checked.

--
components: XML
messages: 178353
nosy: txomon
priority: normal
severity: normal
status: open
title: DTD not checked
type: behavior
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3

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