Il giorno 22 giugno 2016 14:43, Manlio Perillo <manlio.peri...@gmail.com>
ha scritto:

> 2016-06-22 12:43 GMT+02:00 Marco De Paoli <depao...@gmail.com>:
> > pare che urlparse nella lib standard abbia un comportamento un po'
> strano...
> >
> > [...]
> >
> > Daccordo che il port number è un intero a 16-bit, per cui oltre 65535
> non ha
> > senso, però forse mi sarei aspettato un eccezione, mentre invece la port
> > oltre un certo numero viene semplicemente interpretata come None
> >
> >>>> urlparse('redis://localhost:65535').port
> > 65535
> >>>> urlparse('redis://localhost:65536').port is None
> > True
> >
>
> Nell' RFC3986 non è prescritto nessun limite per la porta:
>
>     port          = *DIGIT
>

a quanto pure in futuro python lancerà eccezione

https://github.com/python/cpython/blob/master/Lib/urllib/parse.py#L159

beh, meglio di adesso, che è così

https://github.com/python/cpython/blob/288becf5563483ae9da14c6fb5deb4f32e4cd3d5/Lib/urllib/parse.py#L160

In merito al vincolo sul range 0-65535, ecco la discussione relativa
https://bugs.python.org/issue14036

-marco
_______________________________________________
Python mailing list
Python@lists.python.it
http://lists.python.it/mailman/listinfo/python

Rispondere a