Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Move code to subdirectories and rename or split up#1665

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
filmor merged 2 commits intopythonnet:masterfromfilmor:move-everything-around
Jan 9, 2022

Conversation

filmor
Copy link
Member

What does this implement/fix? Explain your changes.

...

Does this close any currently open issues?

...

Any other comments?

...

Checklist

Check all those that are applicable and complete.

  • Make sure to include one or more tests for your change
  • If an enhancement PR, please create docs and at best an example
  • Add yourself toAUTHORS
  • Updated theCHANGELOG

@@ -609,7 +609,6 @@ internal static PyType AllocateTypeObject(string name, PyType metatype)
/// </summary>
static void InheritSubstructs(IntPtr type)
{
#warning dead code?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Some explanation of what this code does would be useful.
If you don't like the warning - figure it out! :)

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Why do you think that it's dead? The function is being called, after all...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

@filmor it might be doing something that is no longer needed and is essentially no-op

I guess 'dead' might not be the best term here, but from the looks of the code I can't determine its intent.

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I'll give it a try understanding it, but this warning is currently extremely verbose for something that is at least not really a problem :)

Copy link
Member

@lostmsulostmsuJan 8, 2022
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

@filmor see you after returning from the rabbit hole! 😂 (P.S. I never tried this particular one yet)

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Wow, this one tracks through until the initial commit, 15 years ago :)@brianlloyd, you don't happen to know what exactly you were trying to achieve here? :)

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

This code is required for things likePyNumber_Check to work, see e.g.https://github.com/python/cpython/blob/31ff96712e8f89ac1056c2da880b44650002219f/Objects/abstract.c#L830-L837

I don't think it is necessarily required, since our types are structured exactly likePyHeapTypeObject, but this can be revisited if we ever restructure our generated types to be created completely using Python's methods instead of this hackery. It's definitely valid to do this explicit initialisation here.

Copy link
Member

@lostmsulostmsuJan 9, 2022
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

It seems wrong to have it present for types that do not implement numbers protocol.

From the code you linked it looks like our types would passPyNumber_Check. - no it does not, asnb_index,nb_float ornb_int are not set in this function.

Also, what is the relationship betweensq_length andtp_as_sequence and why does one get set to another? And the same for the other two fields...

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

sq_length etc. are the first fields of the respective abstract types. If your type /could/ implement one of them, they have to be set. And our types (being modelled in memory after heap types) always have the respective sections, so it's correct to set them. The checks pass as soon as one of the slots is filled.

@filmorfilmorforce-pushed themove-everything-around branch from1f045de tof9f08a0CompareJanuary 8, 2022 16:09
@filmorfilmor requested a review fromlostmsuJanuary 8, 2022 21:31
@filmorfilmorforce-pushed themove-everything-around branch from039e49b toc294582CompareJanuary 9, 2022 20:01
@filmorfilmor merged commit67dded2 intopythonnet:masterJan 9, 2022
@filmorfilmor deleted the move-everything-around branchJanuary 9, 2022 20:03
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@lostmsulostmsulostmsu left review comments

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@filmor@lostmsu

[8]ページ先頭

©2009-2025 Movatter.jp