Opened 8 years ago

Closed 8 years ago

#15784 closed defect (fixed)

Use `in` instead of deprecated `has_key()`

Reported by: aapitzsch Owned by:
Priority: major Milestone: sage-6.2
Component: misc Keywords: python3
Cc: Merged in:
Authors: André Apitzsch Reviewers: François Bissey
Report Upstream: N/A Work issues:
Branch: 610d145 (Commits, GitHub, GitLab) Commit: 610d145940b3bdc91d8f36d8d293c1adf4d579f1
Dependencies: Stopgaps:

Status badges


The dict.has_key() is not supported in Python 3.0, in favor of the key in d idiom which was introduced in 2.2. Formal deprecation of dict.has_key() began in 2.6.

Change History (10)

comment:1 Changed 8 years ago by aapitzsch

  • Authors set to André Apitzsch
  • Branch set to u/aapitzsch/ticket/15784
  • Commit set to d2e4026bc9521bb2f52e641115c311c032523550
  • Status changed from new to needs_review

comment:2 Changed 8 years ago by vbraun_spam

  • Milestone changed from sage-6.1 to sage-6.2

comment:3 Changed 8 years ago by git

  • Commit changed from d2e4026bc9521bb2f52e641115c311c032523550 to 610d145940b3bdc91d8f36d8d293c1adf4d579f1

Branch pushed to git repo; I updated commit sha1. New commits:

610d145Merge remote-tracking branch 'origin/develop' into py3_has_key

comment:4 Changed 8 years ago by fbissey

Hey André I am willing to review this as I am in debt for the review of the patch bomb that brought python 2.7 in sage. Did you use a script to automate this or was it a long labor in between between grep?

comment:5 Changed 8 years ago by aapitzsch

Hallo, I started with 2to3. But this had some problems with pyx files. So I used grep to find the remaining has_key().

comment:6 Changed 8 years ago by fbissey

OK I also saw the removal of comments and other stuff. Do you consider this finished or you are tracking more instances?

comment:7 Changed 8 years ago by aapitzsch

There are two more has_key. One in misc/cachefunc.pyx which I don't know how to handle and one in sets/ which behaves different from the also included __contains__, so I skipped this as well. These can be fixed in another ticket (if necessary).

comment:8 Changed 8 years ago by fbissey

  • Status changed from needs_review to positive_review

Patchbot seem happy enough about this ticket as far as I can see. Unless I don't know how to read the output.

comment:9 Changed 8 years ago by fbissey

  • Reviewers set to François Bissey

comment:10 Changed 8 years ago by vbraun

  • Branch changed from u/aapitzsch/ticket/15784 to 610d145940b3bdc91d8f36d8d293c1adf4d579f1
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.