Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove type piracy of Base.copy #404

Merged
merged 1 commit into from
Aug 13, 2024
Merged

Conversation

oxinabox
Copy link
Contributor

There was type piracy of Base.copy,
because it was overloaded without any of the types belonging to this package.
This can cause spooky action at a distance -- just loading this package changes what Base.copy does even if you don't load the module directly.
To be precise it turned what used to be a error into an unexpected behavior. This is misdemeanor type piracy. This is thus very unlikely to have actually caused anyone problems.
But still it is poor code form.

Fortunately the code has already been written to refer to Copier.copy in the place it is used.
Which in this case previously resolved to Base.copy which was imported by default (check @which Copier.copy). And the Copier module doesn't use Base.copy already, so we can just rmove the Base. and it will shadow the name.
Some people find shadowing spooky.
The alternative is to give it a different name. Or pass a type that you own to it.)

Related issues

There is no related issue.

Checklist

(I don't think this needs a changelog entry, since it should be invisible to errors unless they were hitting this very unlikely bug)

Copy link

codecov bot commented Aug 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (b29b69b) to head (d105db5).

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #404   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            4         4           
  Lines           81        81           
=========================================
  Hits            81        81           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@abelsiqueira
Copy link
Collaborator

Big miss on our part. I am fine shadowing it, Copier should never export copy et al., so I think that won't bother anyone.

Copy link
Collaborator

@abelsiqueira abelsiqueira left a comment

Choose a reason for hiding this comment

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

Thank you!

@abelsiqueira abelsiqueira merged commit c97f890 into JuliaBesties:main Aug 13, 2024
8 checks passed
@abelsiqueira
Copy link
Collaborator

@allcontributors please add @oxinabox for code, bug, idea

Copy link
Contributor

@abelsiqueira

I've put up a pull request to add @oxinabox! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants