Re: How to build stable 3.9 branch from fork and clone of cpython

2021-05-19 Thread Chris Angelico
On Wed, May 19, 2021 at 1:37 PM  wrote:
>
> > -Original Message-
> > From: Chris Angelico 
> > Sent: Tuesday, May 18, 2021 3:01 AM
> > To: Python 
> > Subject: Re: How to build stable 3.9 branch from fork and clone of cpython
> >
> > On Tue, May 18, 2021 at 4:33 PM  wrote:
> > >
> > > I am following the "Getting Started" section of the Python Developers
> > > Guide, but when I build the first version to verify everything builds,
> > > it builds branch 3.11.
> > >
> > > If I want to build and contribute to branch 3.9, how do I set that up
> > > please?
> > >
> >
> > git checkout 3.9
> >
> > That should switch you to the branch, replacing all the (tracked) files in 
> > the build
> > directory with the corresponding files from 3.9.
> >
> > Be aware that most development is going to happen on the master branch (or
> > the main branch, whichever one you have), and branches like 3.9 are going to
> > get backported patches; so any change you're planning to contribute to 3.9 
> > is
> > going to need to work correctly on both branches.
> >
> > ChrisA
>
> Thanks Chris, that did work.  Thinking over what you said though, perhaps I 
> should change it back.
>
> Would "git checkout main" reverse the branch 3.9 checkout?

Yes, it would!

> As you can probably tell, I am very new to git, so please pardon my ignorance.
>

Fortunately, git may be complex and immensely detailed, but it is also
logical. Also, git works *very* hard to make sure that you don't lose
anything, so it's usually safe to try things out (for instance, if
that "git checkout" command would overwrite changes without being able
to bring them back, it'll let you know).

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


RE: How to build stable 3.9 branch from fork and clone of cpython

2021-05-19 Thread pjfarley3
> -Original Message-
> From: Chris Angelico 
> Sent: Tuesday, May 18, 2021 3:01 AM
> To: Python 
> Subject: Re: How to build stable 3.9 branch from fork and clone of cpython
> 
> On Tue, May 18, 2021 at 4:33 PM  wrote:
> >
> > I am following the "Getting Started" section of the Python Developers
> > Guide, but when I build the first version to verify everything builds,
> > it builds branch 3.11.
> >
> > If I want to build and contribute to branch 3.9, how do I set that up
> > please?
> >
> 
> git checkout 3.9
> 
> That should switch you to the branch, replacing all the (tracked) files in 
> the build
> directory with the corresponding files from 3.9.
> 
> Be aware that most development is going to happen on the master branch (or
> the main branch, whichever one you have), and branches like 3.9 are going to
> get backported patches; so any change you're planning to contribute to 3.9 is
> going to need to work correctly on both branches.
> 
> ChrisA

Thanks Chris, that did work.  Thinking over what you said though, perhaps I 
should change it back.

Would "git checkout main" reverse the branch 3.9 checkout?

As you can probably tell, I am very new to git, so please pardon my ignorance.

Peter

-- 
https://mail.python.org/mailman/listinfo/python-list


Unexpected Inheritance Problem

2021-05-19 Thread Richard Damon
Given the following definition of classes, I am getting an unexpected
error of :

TypeError:  __init__() missing 2 required keyword-only arguments:
'idcode' and 'tag'

On the call to create a GedcomHead in the call to GedcomHead() in
Gedcom0Tag.add()

Code:


class GedcomTag:
    """Represents a Level of a Gedcom file"""

    def __init__(self, parent: 'GedcomTag', level: int, tag: str,
payload: Optional[str]):
    pass


class Gedcom0Tag(GedcomTag):
    """Represents a Level 0 Tag of a GEDCOM file"""

    def __init__(self, *, parent, idcode: Optional[str], tag: str):
    super().__init__(parent=parent, level=0, tag=tag, payload=idcode)

    @classmethod
    def add(cls, *, parent, tag: str, payload: str, level=0):
    """Add Tag based on text"""
    if tag == 'HEAD':
    data = GedcomHead(parent=parent)
    elif tag == 'TRLR':
    data = GedcomTRLR(parent=parent)
    else:
    data = Gedcom0Tag(idcode=tag, tag=payload, parent=parent)
    return data

class GedcomHead(Gedcom0Tag):
    """GEDCOM 0 HEAD tag"""
    def ___init___(self, *, parent):
    super().__init__(parent=parent, idcode=None, tag="HEAD")

Gedcom0Tag.add(parent, 'Head', '')

Note: GedcomHead.__init__() doesn't have these parameters, somehow it seems be 
requiring the parameters for the __init__ call of the base class too, even 
though there is a call to it through the super().__init__()

Is this expected? 
Can derived classes not provide values for parameters to construct the base 
classes?
Is there something funny because I am making the call from a member of that 
base class?




-- 
Richard Damon

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Unexpected Inheritance Problem

2021-05-19 Thread Chris Angelico
On Thu, May 20, 2021 at 2:02 PM Richard Damon  wrote:
>
> Given the following definition of classes, I am getting an unexpected
> error of :
>
> TypeError:  __init__() missing 2 required keyword-only arguments:
> 'idcode' and 'tag'
>
> On the call to create a GedcomHead in the call to GedcomHead() in
> Gedcom0Tag.add()
>
> class Gedcom0Tag(GedcomTag):
> """Represents a Level 0 Tag of a GEDCOM file"""
>
> @classmethod
> def add(cls, *, parent, tag: str, payload: str, level=0):
>
> Gedcom0Tag.add(parent, 'Head', '')
>

You're defining that add takes keyword-only args (because the asterisk
stops them from being passed positionally), but then you're calling it
with nothing but positional args. Is that the code you're using? I
would expect to see *three* missing kwonly args from this.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list