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

allow .NET classes to override __getattr__ and __setattr__#901

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

Closed
lostmsu wants to merge3 commits intopythonnet:masterfromlosttech:PR/GetSetAttr

Conversation

lostmsu
Copy link
Member

@lostmsulostmsu commentedJun 26, 2019
edited
Loading

What does this implement/fix? Explain your changes.

This enables .NET classes to override__getattr__ and__setattr__ by implementingIGetAttr andISetAttr interfaces correspondingly.

How does it work

When constructing a Python type, that will represent C# type, if the C# type implements one of the interfaces, fill corresponding slots in the Python type with custom handlers fortp_getattro ortp_setattro with implementations fromslots.cs.

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

P.S.

This is a single-commit change. Probably could be cherry-picked merged without a merge commit.

@lostmsu
Copy link
MemberAuthor

Looks like .csproj files have varying line endings. Do you guys know how to enforce them in the future?

@lostmsulostmsu marked this pull request as ready for reviewJune 26, 2019 21:01
@lostmsu
Copy link
MemberAuthor

@filmor any idea why that change could have broken x86 tests? I just tried to run Python.EmbeddingTest on Windows with x86, and did not get any crashes or issue? Could it be, that a simple rerun needed (then how to do it?)?

@filmor
Copy link
Member

filmor commentedJun 28, 2019
edited
Loading

It looks good now. Regarding the line endings: IMO we should always have Unix style line-endings everywhere. We could set up a.gitattributes file for this (like outlined here:https://stackoverflow.com/questions/170961/whats-the-best-crlf-carriage-return-line-feed-handling-strategy-with-git), be my guest :)

I use the settingcore.autocrlf = input which does a well enough job.

@lostmsu
Copy link
MemberAuthor

@filmor I don't think it does. x86 builds are still failing in appveyor (unlike, for example, trivial C# version change).

@lostmsu
Copy link
MemberAuthor

Damn, Hyper-V on Windows 10 does not boot x86 linuxes (tried Ubuntu 16.04, 18.04 and the latest Debian)

@lostmsu
Copy link
MemberAuthor

Closing this out, as we decided on ad-hoc approach instead (e.g. one should simply have a__getattr__ method in .NET if he wants to override Python's__getattr__).

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
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
@lostmsu@filmor

[8]ページ先頭

©2009-2025 Movatter.jp