[issue26209] TypeError in smtpd module with string arguments

2016-01-26 Thread Lorenzo Ancora

New submission from Lorenzo Ancora:

smtpd.PureProxy(localaddr="host1", remoteaddr="host2")

...produces the error:

[...] smtpd.py", line 657, in __init__
gai_results = socket.getaddrinfo(*localaddr, type=socket.SOCK_STREAM)
TypeError: getaddrinfo() got multiple values for argument 'type'

The module only works with:

smtpd.PureProxy(localaddr=("host1", 25), remoteaddr=("host2", 25))

The documentation does not specify the format of the INPUT parameters, only the 
CLI syntax with hostnames as "host:port" strings.
The underlying library should convert them to tuples or at least the 
documentation should be completed.

--
components: Library (Lib)
messages: 258971
nosy: lorenzo.ancora
priority: normal
severity: normal
status: open
title: TypeError in smtpd module with string arguments
type: behavior
versions: Python 3.5

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



[issue26209] TypeError in smtpd module with string arguments

2016-02-02 Thread Lorenzo Ancora

Lorenzo Ancora added the comment:

(msg259229) Terry J. Reedy i Suggest that a standard and globally accepted 
scheme to manage IPv4 addresses is:

  "Host:PortNumber" --> (host, PortNumber)
  "Host"--> (host, DefaultPortNumber)
  "IP:PortNumber" --> (host, PortNumber)
  "IP"--> (host, DefaultPortNumber)

...where DefaultPortNumber is protocol and system dependent (IANA standard, see 
the SMTP line in: 
http://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xhtml).

A simple research reveals that all versions of the module are (sadly) poorly 
documented, but the module is an interface to a very important protocol that 
indeed must be offered by the standard library.
The only little suggestion in the documentation of the module is: 
https://docs.python.org/3.6/library/socket.html#socket.socket.accept
...from a one-word link in: 
https://docs.python.org/3.6/library/smtpd.html#smtpd.SMTPChannel.addr
Which has only an indirect relation with the object itself.

Many users may not recognize the cause of the error if the documentation 
doesn't explicitate the information to correctly initialize the core objects of 
the module.
I also Suggest that at least the object should return an helpful error in newer 
versions of Python.

Thank you for your efforts guys. :-)

--
components: +Library (Lib)
versions: +Python 3.2, Python 3.3, Python 3.4

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



[issue26209] TypeError in smtpd module with string arguments

2016-02-06 Thread Lorenzo Ancora

Lorenzo Ancora added the comment:

(msg259475) Terry J. Reedy thank you for the correction, I've confused the 
versions affected with the versions actually supported.
Since this doesn't only affect the documentation, is it correct to assign the 
issue to docs@python?
The expert index indicates giampaolo.rodola as the module maintainer, so he 
should be moved from the nosy list to the field "Assigned To" and docs@python 
should be in the nosy list.

Also, there is a documentation on how to send a patch for a specific module in 
Python 3.5?
I'd like to help by creating a new source code patch. :-)

--

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



[issue26209] TypeError in smtpd module with string arguments

2016-02-06 Thread Lorenzo Ancora

Lorenzo Ancora added the comment:

(msg259748) ok, then I propose to correct 
https://docs.python.org/dev/library/smtpd.html?highlight=q#smtpd.SMTPServer 
from:

.. class:: SMTPServer(localaddr, remoteaddr, data_size_limit=33554432,\
  map=None, enable_SMTPUTF8=False, decode_data=True)

   Create a new :class:`SMTPServer` object, which binds to local address
   *localaddr*.  It will treat *remoteaddr* as an upstream SMTP relayer.  It
   inherits from :class:`asyncore.dispatcher`, and so will insert itself into
   :mod:`asyncore`'s event loop on instantiation.


To:


.. class:: SMTPServer(localaddr, remoteaddr, data_size_limit=33554432,\
  map=None, enable_SMTPUTF8=False, decode_data=True)

   Creates a new :class:`SMTPServer` object, which binds to local address
   *localaddr* and uses *remoteaddr* as an upstream SMTP relayer.
   Both parameters should be a tuple in the form ``("host", portnumber)``, 
where *host* is a valid IP/FQDN.
   The object will insert itself into :mod:`asyncore`'s event loop on 
instantiation (inherits from :class:`asyncore.dispatcher`) and can be started 
with a call to :class:`asyncore.loop`.

---

These clarifications should be also inserted in the source code as heredocs 
(without the Sphynx syntax).
I really think that those changes will make the use of smtpd easier.

--

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