BUG: Series construction sharing data with DTI
State: closed

add a type check for DatetimeIndex and then pass a deep copy to create a Series object


closes #21907 

Labels:
name: Bug

Comments:
also pls for all indices via the indices fixture, we DO test construction on all indices, so maybe you can just add onto these tests, look in pandas/tests/series/test_constructor.py
can you rebase and update
Hello @makbigc! Thanks for updating the PR.

 - There are no PEP8 issues in the file [`pandas/core/series.py`](https://github.com/makbigc/pandas/blob/fd9c8a6224a7e50ca138f63e30122a0b336b6c88/pandas/core/series.py) !

 - There are no PEP8 issues in the file [`pandas/tests/series/test_constructors.py`](https://github.com/makbigc/pandas/blob/fd9c8a6224a7e50ca138f63e30122a0b336b6c88/pandas/tests/series/test_constructors.py) !


# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/22113?src=pr&el=h1) Report
> Merging [#22113](https://codecov.io/gh/pandas-dev/pandas/pull/22113?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/1250500cfe18f60cfb8a4867c82d14467bbee7ad?src=pr&el=desc) will **increase** coverage by `0.05%`.
> The diff coverage is `100%`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/22113/graphs/tree.svg?width=650&token=eZ4WkYLtcO&height=150&src=pr)](https://codecov.io/gh/pandas-dev/pandas/pull/22113?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #22113      +/-   ##
==========================================
+ Coverage   92.23%   92.28%   +0.05%     
==========================================
  Files         161      161              
  Lines       51408    51451      +43     
==========================================
+ Hits        47416    47483      +67     
+ Misses       3992     3968      -24
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.68% <100%> (+0.05%)` | :arrow_up: |
| #single | `42.28% <100%> (-0.02%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/22113?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/series.py](https://codecov.io/gh/pandas-dev/pandas/pull/22113/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvc2VyaWVzLnB5) | `93.69% <100%> (+0.01%)` | :arrow_up: |
| [pandas/core/arrays/datetimelike.py](https://codecov.io/gh/pandas-dev/pandas/pull/22113/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYXJyYXlzL2RhdGV0aW1lbGlrZS5weQ==) | `95.96% <0%> (-0.19%)` | :arrow_down: |
| [pandas/io/formats/format.py](https://codecov.io/gh/pandas-dev/pandas/pull/22113/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2Zvcm1hdHMvZm9ybWF0LnB5) | `97.76% <0%> (-0.12%)` | :arrow_down: |
| [pandas/core/arrays/categorical.py](https://codecov.io/gh/pandas-dev/pandas/pull/22113/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYXJyYXlzL2NhdGVnb3JpY2FsLnB5) | `95.35% <0%> (ø)` | :arrow_up: |
| [pandas/core/ops.py](https://codecov.io/gh/pandas-dev/pandas/pull/22113/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvb3BzLnB5) | `94.27% <0%> (+0.01%)` | :arrow_up: |
| [pandas/core/generic.py](https://codecov.io/gh/pandas-dev/pandas/pull/22113/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZ2VuZXJpYy5weQ==) | `96.84% <0%> (+0.01%)` | :arrow_up: |
| [pandas/io/parsers.py](https://codecov.io/gh/pandas-dev/pandas/pull/22113/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL3BhcnNlcnMucHk=) | `95.57% <0%> (+0.01%)` | :arrow_up: |
| [pandas/core/arrays/datetimes.py](https://codecov.io/gh/pandas-dev/pandas/pull/22113/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYXJyYXlzL2RhdGV0aW1lcy5weQ==) | `98.51% <0%> (+0.03%)` | :arrow_up: |
| [pandas/core/indexes/datetimes.py](https://codecov.io/gh/pandas-dev/pandas/pull/22113/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9kYXRldGltZXMucHk=) | `96.2% <0%> (+0.05%)` | :arrow_up: |
| [pandas/core/arrays/timedeltas.py](https://codecov.io/gh/pandas-dev/pandas/pull/22113/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYXJyYXlzL3RpbWVkZWx0YXMucHk=) | `96.09% <0%> (+0.45%)` | :arrow_up: |
| ... and [2 more](https://codecov.io/gh/pandas-dev/pandas/pull/22113/diff?src=pr&el=tree-more) | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/22113?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/22113?src=pr&el=footer). Last update [1250500...aba2368](https://codecov.io/gh/pandas-dev/pandas/pull/22113?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

closing as superseded by #24096