Praise be to Allah.
There is a dispute amongst the religious scholars regarding the longest period of Nifas (the post-natal bleeding period). Some scholars say it is forty (40) days , others say it is sixty (60) days and some say there is no limit to the maximum number of days a woman can be in a state of Nifas. The most predominant opinion is that the maximum period is forty (40) days according to what is narrated by Umm Salamah. Umm Salamah (may Allah be pleased with her) said "The Nufasa' (a woman in Nifas) used to continue to be in childbed for forty days at the time of the Prophet (peace and blessings be upon him)."
At-Tirmidhi (may Allah have mercy on him) reported: "It is unanimously agreed upon among religious scholars from the Companions and the Successors that the Nufasa' does not pray for forty days unless she sees blood stoppage before the end of the forty days period . She should then perform Ghusl and she resumes praying.
The majority of the religious scholars say that a woman does pray even if she continues to notice blood after the forty days period expires and this is the opinion of the majority of jurists among whom Sufyan Ath-Thawri, Ibn Al-Mubarak, Ash-Shafi`i, Ahmad and Is-haq." (Sunan At-Tirmidhi Hadith # 139)
The same Hadith is also reported by Imam Ahmad, Abu Dawud, Ibn Majah and Ad-Darami and is classified as good by Al-Albani in Irwa' Al-Ghalil (201). Al-Albani (may Allah have mercy on him) has supported this narration by another Hadith reported by Abu Dawud narrated by Umm Salama (may Allah be pleased with her) who said, "A Prophet's (peace and blessings of Allah be upon him) wife used to remain in (a state of) Nifas for forty nights and the Prophet would not ask her to make up the prayers she missed during the period of Nifas".
Ibn Majah also reported that Anas (may Allah be pleased with him) narrated that "The Prophet (peace and blessings of Allah be upon him) had specified a period of forty days for the Nufasa' unless she achieves purity before that." (Irwa' Al Ghalil, 223-222/1)
Therefore, if a woman experiencing post-childbirth bleeding spent forty days and she still sees blood, then we consider this blood as Istihadah (irregular bleeding outside menses) which does not stop a woman from performing prayer nor fasting, unless the end of the forty days coincides with the regular menstrual period; in this case she would consider this blood as menstrual blood.
And Allah knows best.