The patch worked on 0.7.0 and i don't get warning from Python (3.2),
so it seem to have addressed the issue correctly.
(Well i don't get same error at least, once i finish with unittests i
can either confirm or deny lack of side effects)
Thanks!

On Jul 29, 6:38 pm, Michael Bayer <[email protected]> wrote:
> On Jul 29, 2011, at 3:45 AM, Phazorx wrote:
>
> > Most of my entities accept various combinations of parameters and it
> > makes sense for my to use keyword-only pattern of constructors:
>
> > class Person(Root_Entity):
> >    def __init__(self, session, *, first_name, last_name):
>
> > class Address(Root_Entity):
> >    def __init__(self, session, *, street, building, unit=None,
> > zip=None, office=None, city="My City", region=None, country="My
> > Country"):
>
> > however, in this case i get following from python while SQLA figures
> > out relationships:
> >    ValueError: Function has keyword-only arguments or annotations,
> > use getfullargspec() API which can support them
>
> > full traceback:http://dpaste.com/hold/581307/
>
> > Everything is peachy as soon as i get rid of "*," in constructor
> > obviously... but what can i do to preserve such constructors and still
> > be able to use SQLA?
>
> So you're using some Python syntax I've never seen before, let's check 
> (checking...OK its new in Python 3, does not appear to be in the language 
> tutorial either, just in the PEP) and in the first case we'd have to use 
> getfullargspec() in that case when Py3 is in use, however we'd also have to 
> interpret the extended tuple returned by getfullargspec() correctly when we 
> establish instrumentation.
>
> If the following patch works, then we could commit once a test is written, 
> though looking at it I'm not optimistic that some significant extra work 
> might be needed to do this correctly.   Until then this is an unsupported use 
> case.  Ticket #2237 is addedhttp://www.sqlalchemy.org/trac/ticket/2237.
>
> diff -r 87a1dc569235 lib/sqlalchemy/util/compat.py
> --- a/lib/sqlalchemy/util/compat.py     Thu Jul 28 11:53:18 2011 -0400
> +++ b/lib/sqlalchemy/util/compat.py     Fri Jul 29 10:35:23 2011 -0400
> @@ -90,6 +90,11 @@
>      from urlparse import parse_qsl
>
>  if py3k:
> +    from inspect import getfullargspec as inspect_getfullargspec
> +else:
> +    from inspect import getargspec as inspect_getfullargspec
> +
> +if py3k:
>      # they're bringing it back in 3.2.  brilliant !
>      def callable(fn):
>          return hasattr(fn, '__call__')
> diff -r 87a1dc569235 lib/sqlalchemy/util/langhelpers.py
> --- a/lib/sqlalchemy/util/langhelpers.py        Thu Jul 28 11:53:18 2011 -0400
> +++ b/lib/sqlalchemy/util/langhelpers.py        Fri Jul 29 10:35:23 2011 -0400
> @@ -15,7 +15,7 @@
>  import sys
>  import types
>  import warnings
> -from compat import update_wrapper, set_types, threading
> +from compat import update_wrapper, set_types, threading, 
> inspect_getfullargspec
>  from sqlalchemy import exc
>
>  def _unique_symbols(used, *bases):
> @@ -149,7 +149,7 @@
>         'apply_pos': '(self, a, b, c, **d)'}
>
>      """
> -    spec = callable(fn) and inspect.getargspec(fn) or fn
> +    spec = callable(fn) and inspect_getfullargspec(fn) or fn
>      args = inspect.formatargspec(*spec)
>      if spec[0]:
>          self_arg = spec[0][0]
>
>
>
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "sqlalchemy" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to 
> > [email protected].
> > For more options, visit this group 
> > athttp://groups.google.com/group/sqlalchemy?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to